Skip to content

Instantly share code, notes, and snippets.

@McLarenCollege
McLarenCollege / boxesInRowsWithoutMax.js
Last active May 12, 2021 10:54
Boxes in Rows without calculating max
function boxesRows(boxes) {
let result = [];
while (1) {
let count = 0;
let zeroBoxCount = 0;
for (let i = 0; i < boxes.length; i++) {
if (boxes[i] > 0) {
boxes[i]--;
count++;
} else {