Apply a List of Operations to a State
Asked at Oracle · Coding Questions · Difficulty: Medium · Last asked Feb 3, 2026
Build a small engine that applies a list of changes to an inventory. A `State` holds item quantities and string metadata. Each change is an object (a command) with its own `apply` method, so the driver is a plain loop that never branches on the kind of change. Two follow-ups then ask which changes may be swapped and how to shorten a list of changes before it runs.
Loading the problem…
More Oracle interview questions
- Multi-Head Attention from Scratch
- System Design — Event Ingestion + Top-K Aggregation
- OOD — File Management System
- Two-Stack FIFO Queue with Amortized O(1) Operations
- Evaluating an LLM Agent with Subjective, Nondeterministic Outputs
- Same N-ary Tree Comparison