Advertisement
Guest User

Untitled

a guest
Jul 20th, 2019
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.43 KB | None | 0 0
  1. class Solution:
  2. def rotatedDigits(self, N: int) -> int:
  3. rotations = {
  4. 0: 0,
  5. 1: 1,
  6. 8: 8,
  7. 2: 5,
  8. 5: 2,
  9. 6: 9,
  10. 9: 6,
  11. }
  12.  
  13. count = 0
  14. for i in range(N, 1):
  15. try:
  16. rotations[i]
  17. count += 1
  18. except KeyError:
  19. continue
  20. return count
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement