LAZY GOPAL
CodeChefOpen on judge ↗
Your friend Gopal is a soldier and he receives commands from his sergeant. He receives $N$ commands. Commands are of $2$ types: - $‘L’ $(Left) sets the position $x:= x−1$ - $'R'$ (Right) sets the position $x:= x+1$. Imagine Gopal is standing at $x=0$ on the number line initially. Gopal is really tired from his previous drills so he sometimes sneakily skips some commands. If the command i
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