you start cell rStart cStart row x col grid face east the northwest corner row column grid southeast corner row columnyou walk clockwise spiral shape visit position grid whenever outside grids boundary continue walk outside grid return grid boundary later eventually reach row cols space gridreturn array coordinate represent position grid order visit Example 1input row 1 col 4 rstart 0 cStart 0output 00010203example 2input row 5 col 6 rStart 1 cStart 4Output 141525242313030405353433322212024544434241312111014030201000 Constraints1 row col 1000 rStart rows0 cStart col