← All problemsSign in

Move the Robot

A robot is placed on an infinitely long line. Initially, the position of the robot is 0. Pankaj sends commands to move this robot. You are given a string s. For each i, the i-th character of s (0-based index) represents the i-th command Pankaj sends. If the i-th character of commands is 'R', the robot moves one unit to the right (i.e., from position x to position x+1). If this character is 'L', t

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