traversing a map

Solutions on MaxInterview for traversing a map by the best coders in the world

showing results for - "traversing a map"
Davide
19 Jan 2019
1int arr[] = { 1, 1, 2, 1,  3, 1, 4, 3 };
2map<int, int> m;
3for (auto i: arr)
4	m[arr[i]]++;
5cout << "Element  Frequency" << endl;
6for (auto& [k,v] : m) // Since c++17
7	cout << k << "   " << v << endl;