<commit_before>import collections
import unittest

import utils


# O(capacity) space. Hash table, linked list.
class LRUCache:
    # O(1) time. O(1) space.
    def __init__(self, capacity: int):
        self.capacity = capacity
        self.cache = collections.OrderedDict()

    # O(1) time. O(1) space.
    def get(self, key: int) -> int:
        val = self.cache.get(key)<commit_msg>146. LRU Cache<commit_after>import collections
import unittest

import utils


# O(capacity) space. Hash table, linked list, ordered dict.
class LRUCache:
    # O(1) time. O(1) space.
    def __init__(self, capacity: int):
        self.capacity = capacity
        self.cache = collections.OrderedDict()

    # O(1) time. O(1) space.
    def get(self, key: int) -> int:
        val = self.cache.get(key)
{'fraction_non_alphanumeric': 0.12420785804816223, 'fraction_numerical': 0.01394169835234474, 'mean_word_length': 2.872549019607843, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '954127', 'n_tokens_mistral': 269, 'n_tokens_neox': 260, 'n_words': 77}