What goes in the blank?
from collections import OrderedDict
# LRU cache: mark key as most recently used
def get(self, key):
if key not in self.cache:
return -1
self.cache.____(key)
return self.cache[key]
Answer: move_to_end
move_to_end puts the key at the back; eviction pops from the front with popitem(last=False).
Play Problem Solving ▸