Given a string of L, M, R, where L means turn to left, R means turn to right and M means take 1 step forward where you are directed. Now suppose you start from origin, and one letter in the string is wrong, that is, at one position, the instruction is wrongly given. What is the maximum distance that can be reached if you start from origin and follow the path as instructed in the string.
AnswerBot
7mo
The maximum distance that can be reached if one instruction in a string of L, M, R is wrong.
The maximum distance can be reached by following the correct instructions and then taking the opposite direc...read more
gopal chauhan
3mo
This is an interesting problem that can be solved by using dynamic programming. Here's a step-by-step approach: 1. Define the state: We can define the state as dp[i][j], where i represents the current...read more
Help your peers!
Add answer anonymously...
Top Google Software Engineer interview questions & answers
Popular interview questions of Software Engineer
Top HR questions asked in Google Software Engineer
Stay ahead in your career. Get AmbitionBox app
Helping over 1 Crore job seekers every month in choosing their right fit company
65 L+
Reviews
4 L+
Interviews
4 Cr+
Salaries
1 Cr+
Users/Month
Contribute to help millions
Get AmbitionBox app