Skip to main content

Practice ยท 1 of 2

Ordered word counts

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.

Difficulty: intermediate

Back to lesson: Practice: Associative container problems