Advertisement
Guest User

Untitled

a guest
Mar 19th, 2018
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.39 KB | None | 0 0
  1. class Solution(object):
  2. def judgeCircle(self, moves):
  3. x = 0
  4. y = 0
  5. for lett in moves:
  6. if lett == "U":
  7. y += 1
  8. elif lett == "D":
  9. y -= 1
  10. elif lett == "L":
  11. x += 1
  12. else:
  13. x -= 1
  14. if x or y:
  15. return False
  16. return True
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement