Skip to content

Latest commit

 

History

History
24 lines (15 loc) · 344 Bytes

File metadata and controls

24 lines (15 loc) · 344 Bytes

657 Robot Return to Origin

Description

link


Solution

  • See Code

Code

O(n)

class Solution:
    def judgeCircle(self, moves: str) -> bool:
        cnt = collections.Counter(moves)
        return cnt['U'] == cnt['D'] and cnt['L'] == cnt['R']