Algorithm · Meta · Medium
Problem: Expiring Key-Value Cache Create a key-value cache in which every stored key is assigned a time-to-live (TTL). When the current timestamp is equal to or later than a key's expiration timestamp, the cache must behave as though that key is absent. You receive Q operations in chronological order; their timestamps never decrease. Operations Each of the Q operations uses one of these formats: SET t key value ttl At time t, associate key with value and set its expiration…
Checking your access…