Skip to main content

Practice · 1 of 2

Ordered word counts

CHALLENGE
Difficulty: intermediate+25 XP

Implement std::map<std::string, int> word_counts(const std::vector<std::string>& words) counting occurrences of each word. The returned map must iterate in sorted key order — that ordering is part of the contract, so an unordered_map will fail the sorted test.

Back to lesson: Practice: Associative container problems