String
657. Robot Return to Origin
A robot follows a string of L/R/U/D moves from the origin — does it end back at (0,0)? It returns iff its net horizontal and net vertical displacement are both zero, so just tally the two axes…
Loading…
A robot follows a string of L/R/U/D moves from the origin — does it end back at (0,0)? It returns iff its net horizontal and net vertical displacement are both zero, so just tally the two axes…
Loading…