Guest User

Untitled

a guest
Jul 16th, 2018
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.72 KB | None | 0 0
  1. # Palindrome
  2. ```python
  3. import re
  4.  
  5. def isPalindrome(str):
  6. # TODO
  7. pass
  8.  
  9.  
  10. assert isPalindrome('asdf') == False
  11. assert isPalindrome('dmdmdm') == False
  12. assert isPalindrome('00100') == True
  13. assert isPalindrome('asdfdsa') == True
  14. assert isPalindrome('a--[A]--A') == True
  15. assert isPalindrome('X.-u--=DVDu==***x') == True
  16. ```
  17.  
  18. # LRU(Least Recently Used)
  19.  
  20. ### Cache Hit Delay: 1
  21. ### Cache Miss Delay: 5
  22.  
  23. ```python
  24. def lru(sequence=[], cache_size=0):
  25. TODO
  26.  
  27. assert lru(["donut", "juice", "apple", "banana"], 3) == 20 # True
  28. assert lru(["donut", "juice", "apple", "donut"], 3) == 16 # True
  29. assert lru(["donut", "juice", "apple", "donut"], 0) == 20 # True
  30. assert lru(["donut", "juice", "apple", "donut", "apple", "coffee"], 5) == 22 # True
  31. ```
Add Comment
Please, Sign In to add comment