Practice ยท 2 of 2
Deduplicate keeping the last occurrence
Implement std::vector<std::string> dedupe_last(const std::vector<std::string>& v) removing duplicates so each value appears once โ at the position of its LAST occurrence, preserving overall order. Example: {"a","b","a","c"} becomes {"b","a","c"}. A single index map plus one pass is enough.
Difficulty: intermediate
Press Submit to check your solution.
Back to lesson: Practice: Associative container problems