You are viewing a single comment's thread. Return to all comments →
function toys(w) { let container = 1; const sortedWeights = w.sort((x, y) => x - y); let currentMinimum = sortedWeights[0] + 4; sortedWeights.forEach((value) => { if (value > currentMinimum) { currentMinimum = value + 4; container++; } }); return container; }
Priyanka and Toys
You are viewing a single comment's thread. Return to all comments →
JavaScript Solution