Return at most limit unique Text words beginning with exact prefix, sorted lexicographically by code points. Empty words/prefix valid; zero limit returns empty; negative limit throws invalid_argument. Prototype filter/deduplicate/sort; final build trie, follow prefix, ordered traversal. Include construction cost. Preserve words.
Public signatures:
Vec<Text> prototype(const Vec<Text>& words,const Text& prefix,const Int& limit);
Vec<Text> solve(const Vec<Text>& words,const Text& prefix,const Int& limit);Compile and run from this directory:
c++ -std=c++20 -O2 -Wall -Wextra -pedantic -pthread main.cpp -o practice
./practice --stage prototype
./practice --stage finalEdit 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.
Complete the starter code, then run the checks.
Results and errors will appear here.
C++ runtime powered by Wasmer.