You are viewing a single comment's thread. Return to all comments →
JavaScript
function toys(w) { w.sort((a, b) => a - b); let minContainers = 1; let minWeightRangeEnd = 4 + w[0]; for (let i = 0; i < w.length; i++) { if (w[i] > minWeightRangeEnd) { minContainers++; minWeightRangeEnd = 4 + w[i]; } } return minContainers; }
Seems like cookies are disabled on this browser, please enable them to open this website
Priyanka and Toys
You are viewing a single comment's thread. Return to all comments →
JavaScript