path, where each letter is one step to a neighbouring cell:
- U means up,
- D means down,
- L means left,
- R means right.
The way the drone is facing does not matter: a letter always moves it exactly one cell in that direction.
Return True if the drone is back over the pad once the whole route is flown, and False otherwise.path="URDL" → True
The drone flies around a square (up, right, down, left) and ends where it took off.
path="UUD" → False
Two steps up and only one down leave the drone one cell above the pad.
path="RRLLDU" → True
path contains only the letters U, D, L, Rpath="URDL"
True
Run checks the first 3 tests in your browser. Submit checks all 115 tests on the server, hidden ones included.