Prototype: implement prototype(List<Command> commands) returning List<Object> with a direct baseline.

Final: implement solve(List<Command> commands) with the mechanism and bounds described above. Start empty. Commands add/remove return Boolean indicating a change; contains returns Boolean; floor returns the largest stored Long <= key or null. Return one result per command. Duplicate adds and missing removals are false. Unknown operation raises IllegalArgumentException. List<Object> intentionally models the Boolean/Long/null tagged result union. Both stages have the same observable contract. The prototype may use the simpler method; final must use the target data structure.

The supplied nested record types define the API. All methods are static members of Exercise.

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.