Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Palindrome
- ```python
- import re
- def isPalindrome(str):
- # TODO
- pass
- assert isPalindrome('asdf') == False
- assert isPalindrome('dmdmdm') == False
- assert isPalindrome('00100') == True
- assert isPalindrome('asdfdsa') == True
- assert isPalindrome('a--[A]--A') == True
- assert isPalindrome('X.-u--=DVDu==***x') == True
- ```
- # LRU(Least Recently Used)
- ### Cache Hit Delay: 1
- ### Cache Miss Delay: 5
- ```python
- def lru(sequence=[], cache_size=0):
- TODO
- assert lru(["donut", "juice", "apple", "banana"], 3) == 20 # True
- assert lru(["donut", "juice", "apple", "donut"], 3) == 16 # True
- assert lru(["donut", "juice", "apple", "donut"], 0) == 20 # True
- assert lru(["donut", "juice", "apple", "donut", "apple", "coffee"], 5) == 22 # True
- ```
Add Comment
Please, Sign In to add comment