Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Solution(object):
- def judgeCircle(self, moves):
- x = 0
- y = 0
- for lett in moves:
- if lett == "U":
- y += 1
- elif lett == "D":
- y -= 1
- elif lett == "L":
- x += 1
- else:
- x -= 1
- if x or y:
- return False
- return True
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement