水一题弱题庆祝IBM MQ搭建成功。

class Solution(object):
    def judgeCircle(self, moves):
        """
        :type moves: str
        :rtype: bool
        """
        result = [0, 0]
        for i in moves:
            for k, v in (('R', (1, 0)),
                        ('L', (-1, 0)),
                        ('U', (0, 1)),
                        ('D', (0, -1))):
                if i == k:
                    result[0] += v[0]
                    result[1] += v[1]

        return result[0] == 0 and result[1] == 0

相关文章:

  • 2021-11-14
  • 2021-08-05
  • 2022-12-23
  • 2022-01-01
  • 2022-02-06
  • 2021-12-15
  • 2021-06-03
猜你喜欢
  • 2021-07-31
  • 2021-08-10
  • 2022-12-23
  • 2022-03-06
  • 2021-05-25
  • 2021-05-26
相关资源
相似解决方案