Back to problems

Account Scheduler with LRU

Object-Oriented Programming · Stripe · Medium

Requirements Initialize the object with a list of account_ids and a locked_until mapping that gives the unlock timestamp for every account. is_available(account_id, t) must report whether that account is unlocked at time t. Calls arrive in sequence, and no concurrent access needs to be handled. Follow-up 1: acquire(account_id, duration) Starting at the current query time t, set the account's lock expiration to t + duration: This assignment applies even if the account was…

Checking your access…