You are viewing a single comment's thread. Return to all comments →
C# solution is shown below
public static List<int> cutTheSticks(List<int> arr) { List<int> ret = new List<int>(); while (arr.Count>0) { ret.Add(arr.Count); int min = arr.Min(); List<int> tmp = new List<int>(); for (int i = 0; i < arr.Count; i++) if (arr[i] > min) tmp.Add(arr[i] - min); arr = tmp; } return ret; }
Seems like cookies are disabled on this browser, please enable them to open this website
Cut the sticks
You are viewing a single comment's thread. Return to all comments →
C# solution is shown below