prototype and solve return surviving values in original order, excluding all blocked values; preserve both vectors. Also implement detach(std::unique_ptr<Node> head, const std::set<Int>& blocked) in BOTH stages. Transfer ownership, relink existing nodes, preserve survivor addresses and order, destroy removed nodes, and return null for no survivors. No replacement survivor allocations or cycles. Node observers are valid only while their node survives.

Public signatures:

cpp

Vec<Int> prototype(const Vec<Int>& values,const Vec<Int>& blocked);
Vec<Int> solve(const Vec<Int>& values,const Vec<Int>& blocked);

Compile and run from this directory:

Shell
c++ -std=c++20 -O2 -Wall -Wextra -pedantic -pthread main.cpp -o practice
./practice --stage prototype
./practice --stage final

Edit exercise.hpp. Both stages start unfinished and must report failures until implemented. Keep main.cpp as the executable contract. The runner returns nonzero for a failed check, an unexpected exception, an invalid stage, or an empty suite. C++20 and only the standard library are required.

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.

C++ runtime powered by Wasmer.