You are viewing a single comment's thread. Return to all comments →
c#
public static int equalizeArray(List<int> arr) { Dictionary<int, int> memberAmount = new Dictionary<int, int>(); List<int> distinct = arr.Distinct().ToList(); for(int i = 0; i< distinct.Count(); i++) { int count = arr.Count(p => p == distinct[i]); memberAmount.Add(distinct[i], count); } return arr.Count() - memberAmount.Values.Max(); }
Seems like cookies are disabled on this browser, please enable them to open this website
Equalize the Array
You are viewing a single comment's thread. Return to all comments →
c#