Robert Half's job search experience may cache frequently accessed job listings. Implement an LRU cache that stores key-value pairs and evicts the least recently used entry when its capacity is exceeded.
The cache must support get and put operations in O(1) average time. A successful get marks the key as most recently used. Updating an existing key with put also marks it as most recently used. A missing key returns None.
Implement lru_cache(capacity, operations):
capacity is a positive integer.operations is a list of operations. Each operation is either ['get', key] or ['put', key, value].get operation, in order. put operations produce no result.def lru_cache(capacity, operations):