leetcode - 657 - 机器人能否返回原点

class Solution:
    def judgeCircle(self, moves):
        """
        :type moves: str
        :rtype: bool
        """
        m=moves.count("U")
        n=moves.count("D")
        j=moves.count("L")
        k=moves.count("R")
        
        return m==n and j==k

       

猜你喜欢

转载自blog.csdn.net/hustwayne/article/details/83544960