Sort the Towers
Hard · Algorithms
Towers of balls stand on the bottom row, one per column (a column may be empty). Sort them from shortest on the left to tallest on the right.
Your code runs in several worlds. Measure every tower (picking up its balls), sort the heights, then rebuild the towers in order. Arrays have a sort method: heights.sort((a, b) => a - b).
Next: Follow the Trail Home