there n x n grid topleft cell 0 0 bottomright cell n 1 n 1 you give integer n integer array startpos startpos startrow startcol indicate robot initially cell startrow startcolyou give 0indexed string s length m si ith instruction robot L leave r right u D downthe robot begin execute ith instruction s it execute instruction end s stop condition metthe instruction robot gridThere instruction leave executeReturn array answer length m answeri number instruction robot execute robot begin execute ith instruction s Example 1input n 3 startpos 01 s rrddluoutput 154310explanation start startpos begin execution ith instruction 0th RRDDLU only instruction r execute move grid 1st RDDLU all instruction execute stay grid end 1 1 2nd DDLU all instruction execute stay grid end 1 0 3rd DLU all instruction execute stay grid end 0 0 4th LU only instruction l execute move grid 5th u if move gridExample 2input n 2 startpos 11 s LURDOutput 4100explanation 0th LURD 1st URD 2nd RD 3rd DExample 3input n 1 startpos 00 s lrudoutput 0000explanation no matter instruction robot begin execution grid Constraintsm slength1 n m 500startposlength 20 startrow startcol n consist L R u d