Python


  • 0
    P
    class Solution:
        def judgeCircle(self, moves):
            """
            :type moves: str
            :rtype: bool
            """
            if len(moves) < 2:
                return False
            
            if moves.count('L') == moves.count('R'):
                if moves.count('U') == moves.count('D'):
                    return True
            
            return False
    

Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.