Implement prototype(commands: list[tuple[str, int]]) -> list[bool | int | None] and solve with the same signature. Start with an empty set and process commands in order. ('add', key) and ('remove', key) return bool indicating whether the set changed. ('contains', key) returns bool. ('floor', key) returns the largest stored integer <= key, or None. Return one result per command; [] returns [].

Example: [('add',3), ('add',3), ('floor',4), ('remove',9)] returns [True, False, 3, False]. Unknown operations raise ValueError.

Prototype: use an unsorted unique-key list. Final: implement a BST with correct deletion and floor search. Preserve commands. Return actual booleans for boolean operations, not integer substitutes.

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.