We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
class TimeMap { public: unordered_map<string, set<pair<int,string>>> mp; TimeMap() { mp.clear(); }
void set(string key, string value, int timestamp) { mp[key].insert({timestamp, value}); } string get(string key, int timestamp) { if(mp[key].size() != 0){ auto it = mp[key].upper_bound({timestamp, "~"}); if(it == mp[key].begin()) return ""; --it; return it->second; } return ""; }
};
The text was updated successfully, but these errors were encountered:
No branches or pull requests
class TimeMap {
public:
unordered_map<string, set<pair<int,string>>> mp;
TimeMap() {
mp.clear();
}
};
The text was updated successfully, but these errors were encountered: