At the jump rope contest, skips is how many jumps each person did in a minute. 100 or more wins "gold", 80 or more "silver", 60 or more "bronze", and under 60 gets no medal. Fill in the loop to count how many of each medal were given; a medal nobody won doesn't appear.
medals({120, 85, 61, 30})→{'bronze': 1, 'gold': 1, 'silver': 1}medals({})→{}map<string, int> medals(const vector<int> &skips)#include <map>
#include <string>
#include <vector>
using namespace std;
map<string, int> medals(const vector<int> &skips) {
map<string, int> count;
for (int s : skips) {
// your code here: find s's medal and add 1 to it
}
return count;
}
Run tries the examples. When they look right, Submit.