[C#][LeetCode][Easy] 657. Judge Route Circle


右 X + 1, 左 X – 1, 上 Y + 1, 下 Y – 1,最後 X 與 Y 皆為0則回傳true


Initially, there is a Robot at position (0, 0). Given a sequence of its moves, judge if this robot makes a circle, which means it moves back to the original place.

The move sequence is represented by a string. And each move is represent by a character. The valid robot moves are R (Right), L (Left), U (Up) and D (down). The output should be true or false representing whether the robot makes a circle.

Example 1:

Example 2:


答案 – Linq: