You are viewing a single comment's thread. Return to all comments →
function cutTheSticks(arr) { let sticks = []; while(arr.length){ sticks.push(arr.length) const min = Math.min(...arr); arr = arr.map(stick => stick - min).filter(stick => stick); } return sticks; }
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 →
JavaScript solution: