skip to content
developertype

snippets

filter:96 snippets
cpp-gen-hashmap·cpp·general
#include <string>
#include <unordered_map>
#include <vector>

std::unordered_map<std::string, int> frequency(
    const std::vector<std::string>& words) {
    std::unordered_map<std::string, int> freq;
    for (const auto& w : words) ++freq[w];
    return freq;
}