Cache Query Handler

Problem Overview

  • Build a cache query handler that returns the stored value for a given key and timestamp.
  • Input: cache_entries (n x 3: timestamp, key, value) and queries (q x 2: key, timestamp); Output: array of q values, all pairs guaranteed present.
  • Constraints: n,q ≤ 1e5; timestamps hh:mm:ss; keys lowercase alphanumeric; no duplicate keys at the same time.
  • Real-world domain: cache lookup in data systems; a problem and interview question for a coding interview, asked in Ibm interviews.

Example

Unlock to view complete problem details

and practice with sample input/output

Was this article helpful?

View Test Cases & Run Code requires membership

Input Variables
Execution Result: