• + 0 comments

    Python3 Solution

    def cutTheSticks(arr):
        # Write your code here
        arr = sorted(arr, reverse=True)
        
        res = [len(arr)]
        currVal = arr[-1]    
        while len(arr) > 0:
            if currVal != arr[-1]:
                res.append(len(arr))
                currVal = arr[-1]
            arr.pop(-1)
        
        return res