12503 - Robot Instructions

Difficulty : easy

Solution Description :
Adhoc problem

At First set Ans = 0
If Instruction is Left then add -1 at Ans
If Instruction is Right then add +1 at Ans

If same as n then go to instruction n then find it is Left or Right
You can store previous instruction in array.

Instruction can be more than 100. i.e. if you use array then declare index 110.