public class Solution { public int SingleNumber(int[] nums) { var hash = new Dictionary(); for(var i = 0;i < nums.Length; i++){ if(!hash.ContainsKey(nums[i])){ hash.Add(nums[i],1); } else{ hash[nums[i]]++; } } foreach(var k in hash.Keys){ if(hash[k] == 1){ return k; } } return -1; } }