• + 0 comments

    Here is my Python solution! Using a while loop, we continually cut the sticks and remove the ones that have the least length and add the amount of sticks remaining to the answer.

    def cutTheSticks(arr):
        answer = []
        while len(arr) != 0 or len(set(arr)) == 1:
            answer.append(len(arr))
            shortest = min(arr)
            arr = [stick - shortest for stick in arr if stick != shortest]
        return answer