Approach

Since we just need to know if it will return to it’s starting place, just check if all moves cancel out (equal rights to lefts and up’s to downs.)

Code

class Solution:
    def judgeCircle(self, moves: str) -> bool:
        return (moves.count("U") == moves.count("D")) and (moves.count("L") == moves.count("R"))