Let Them Fall
Hard · Algorithms
Gravity is switched on! In every column, the balls fall down and stack on top of each other, one ball per square, starting from the bottom row.
Every square starts with at most one ball. Your code runs in several rooms with balls in different places.
Hint: for each column, count the balls while you climb up and collect them, then rebuild them from the bottom.
Next: Build a Pyramid