You are viewing a single comment's thread. Return to all comments →
class Result { public static List<int> cutTheSticks(List<int> arr) { List<int> result = new List<int>(); result.Add(arr.Count); while(arr.Count > 0) { int min = arr.Min(); arr = arr.Select(num => num - min).ToList(); arr.RemoveAll(num => num <= 0); if(arr.Count > 0) result.Add(arr.Count); } return result; } }
Cut the sticks
You are viewing a single comment's thread. Return to all comments →
C# Solution: