Prototype: touchOrder(keys,key) returns a new oldest-to-newest list with key appearing once at the end. Inputs are distinct nonempty keys.

Final: LRUCache(int capacity) requires capacity >= 0; keys are nonempty, values long (negative allowed). put inserts/updates, refreshes recency, and evicts oldest if needed; zero capacity makes valid puts no-ops. get(key,fallback) returns Long and refreshes a hit, or the exact fallback object on miss without recency change. delete is idempotent. items() returns Entry records oldest first.

The complete public API is in Exercise.java. All domain classes are public static nested classes of Exercise; construct them as new Exercise.ClassName(...). Do not implement a solution in the test runner. Each instance owns independent state. Unless explicitly allowed, null inputs are outside the domain. Failed operations leave state unchanged; validation happens before mutation.

Drag or use the arrow keys to resize. Home collapses the question; End collapses the editor. Enter or double-click resets the split.
Loading editor…
No results yet.

Complete the starter code, then run the checks.
Results and errors will appear here.

Java runs on this device with CheerpJ 4.3.