Skip to content

Latest commit

 

History

History
27 lines (25 loc) · 487 Bytes

657.md

File metadata and controls

27 lines (25 loc) · 487 Bytes
class Solution:
    def judgeCircle(self, moves):
        """
        :type moves: str
        :rtype: bool
        """
        U = 0
        L = 0
        for c in moves:
            if c == 'U':
                U += 1
            elif c == 'D':
                U -= 1
            elif c == 'L':
                L += 1
            else:
                L -= 1
        if U == 0 and L == 0 :
            return True
        else:
            return False

字符串处理

string