You are viewing a single comment's thread. Return to all comments →
JS
const sticks_cut = [arr.length]; let arrCut = arr; while (1) { let length_cut = Math.min(...arrCut); arrCut = arrCut .filter((item) => item !== length_cut) .map((item) => item - length_cut); if (arrCut.length === 0) break; sticks_cut.push(arrCut.length); } return sticks_cut
Cut the sticks
You are viewing a single comment's thread. Return to all comments →
JS