3
map<int, unordered_set<string>> minmax;4
unordered_map<string, int> count;8
int was = count[key]++;10
minmax[was].erase(key);11
if (minmax[was].size() == 0) minmax.erase(was);13
minmax[was + 1].insert(key);16
void dec(string key) {17
int was = count[key]--;18
minmax[was].erase(key);19
if (minmax[was].size() == 0) minmax.erase(was);23
minmax[was - 1].insert(key);28
return minmax.size() == 0 ? "" : *minmax.rbegin()->second.begin();32
return minmax.size() == 0 ? "" : *minmax.begin()->second.begin();37
* Your AllOne object will be instantiated and called as such:38
* AllOne* obj = new AllOne();41
* string param_3 = obj->getMaxKey();42
* string param_4 = obj->getMinKey();