Implement Cache, Undo, and DFS
Company: Netflix
Role: Software Engineer
Category: Coding & Algorithms
Interview Round: Onsite
Quick Answer: This question evaluates implementation skills in data structures, algorithmic complexity, and state-management patterns by combining a timed in-memory cache, a command-undo manager, and depth-first traversal of an organizational tree, and is categorized under Coding & Algorithms.
Part 1: Timed Cache Simulator
Constraints
- 0 <= len(operations) <= 2 * 10^5
- Timestamps used in `put`, `get`, and `cleanup` are non-decreasing integers.
- 0 <= ttl <= 10^9
- Keys are hashable Python literals such as strings or integers.