Prototype: allowRequest(recent,limit,window,now) validates positive limit/window, nonnegative now, and nondecreasing nonnegative history no later than now. Filter timestamps strictly greater than now-window; append now only if active size < limit. Return Decision(allowed,newHistory). Retain all active history even if already over limit; do not mutate input.

Final: SlidingWindowLimiter applies that rule per nonempty client ID. allow rejects backward per-client calls (including after denial), and accepted/denied valid calls update that client's observed time. Different clients have independent time. history returns a new retained list without expiring or advancing time.

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.