Left and Right Direction | Internship Interview Question
Anonymous User
713

Internship coding Round Question

You are at position (0,0) and have to maximize the displacement by moving in only 2 direction
L - means 1 unit dist in left direction
R- means 1 unit dist in right direction

Given string replace the char '?' with L or R to maximize the displacement.

Input:
first line string S

ouput: maximum displacement

Example:
?RRR?

Comments (2)