I am currently trying to work on a function to get the mode of a set of integers, using a hash map. I was given the following to start with:
int GetMode(const vector<int>& input) {
// assumes the range is [0-10]
unordered_map<int, int> counts;
for (int value : input) {
++counts[value];
}
for (auto kv_pair : counts) {
// find the max
}
}
My only question is, what is auto kv_pair? I have never seen this code, so I am not sure what the for loop condition is really looking at to finish this out. Can anyone help out?
