public class Solution { public IListMajorityElement(int[] nums) { if(nums == null || nums.Length == 0){ return new List (); } var hash = new Dictionary (); var len = nums.Length; for (var i = 0;i < len; i++) { if(!hash.ContainsKey(nums[i])) { hash.Add(nums[i],1); } else{ hash[nums[i]]++; } } var ret = new List (); foreach(var k in hash.Keys) { if(hash[k] > len / 3){ ret.Add(k); } } return ret; } }