Last active
June 7, 2021 15:53
-
-
Save ekampf/384b740f76d7cf061adfb47f3cfebe23 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Implement a cache class that stores given item. The cache is limited to a given `size` and will discard the | |
least recently used item if it needs the space. | |
Clearly document design choices, algorithm and possible optimizations. | |
While we require you to implement one memory allocation algorithm, | |
also document future looking design considerations. | |
Implementation Notes: | |
* While the interface below is written in Python, feel free to implement the Cache in the language of your choosing. | |
* Do not use standard library data structures - write your own. (like Python's `collections` module etc.) | |
*** Requirements *** | |
1. Working code (obviously). | |
2. Unit tests (using a unit testing library of your choosing) | |
3. Documentation (as describe in the 2nd paragraph above) | |
""" | |
class Cache: | |
def __init__(self, size: int): | |
pass | |
def get(self, key) -> ?: | |
pass | |
def set(self, key, value) -> ?: | |
pass |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment