Prototype: implement prototype(long[] values, long[] blocked) returning List<Long> with a direct baseline.
Final: implement solve(long[] values, long[] blocked) with the mechanism and bounds described above. prototype and solve return surviving values in order, omitting all blocked values without changing either array. Also implement detach(Node head, Set<Long> blocked) in both stages: relink existing nodes, preserve survivor identity/order, do not mutate blocked, and terminate without a cycle. Null or complete removal returns null. Temporary sentinels are allowed. 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.
Complete the starter code, then run the checks.
Results and errors will appear here.
Java runs on this device with CheerpJ 4.3.