Easy python solution


  • 0
    Z
    class Solution(object):
        def judgeCircle(self, moves):
            """
            :type moves: str
            :rtype: bool
            """
            dict_move = {}
            for move in ['U','D','R','L']:
                dict_move[move]=0
            for char in moves:
                dict_move[char]+=1
            if dict_move['U']==dict_move['D'] and dict_move['L']==dict_move['R']:
                return True
            else:
                return False

Log in to reply
 

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