/Cut-the-Sticks

Given an array, lengths, of N stick lengths (where each length is a positive integer), a cut operation reduces the length of each stick in the array by the length of the array's shortest stick. A stick can only be cut if it has a length ≥ 1. Complete the cutSticks() function. Your function must perform cut operations on lengths until every stick length is reduced to 0 and return an integer array, where ith element of the array denotes the individual sticks cut during the ith operation. Your function must return an integer array or list, where ith element of the array denotes the individual sticks cut during the ith operation.

Watchers