Bouncing Ball
You are given an array $A$ of length $N$, where each element represents either empty ground ($A_i = 0$) or a wall (a positive integer indicating the height of the wall). You can place a ball on any empty ground (that is, choose an index $i$ with $A_i = 0$) and push it either to the right or to the left. When the ball hits a wall, it decreases the height of the wall it hit by $1$, and then bounc
HINT LADDERno hints yet
L1 Observation
L2 Technique
L3 Approach
L4 Pseudo-code
🔒
L5 Full solution
L5 unlocks only if you insist twice
solution.cppC++17
CodeSearch Tutor
Hints, not spoilers — it won’t hand over the full solution unless you insist.
Sign in to chat with the tutor and save your progress.
Sign in to start