← All problemsSign in

Bouncing Ball

Consider infinite well bounded by lines x=0 and x=n. A ball starts bouncing from origin x=0 taking step of size 1 in 1st second, step of size 2 in 2nd second, ... step of size k in kth second. When it reaches any of wall it reflects back. For example consider a well bounded by x=0 and x=9. After 1 second ball will be at x=1, similarily ball will be at x=3, x=6, x=8, ... after t=2, t=3, t=4... sec

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.

voice by Sarvam AI

Sign in to chat with the tutor and save your progress.

Sign in to start