Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Solution {
- public:
- int maximumPopulation(vector<vector<int>>& logs) {
- map<int, int> m;
- for(auto v: logs){
- m[v[0]] += 1;
- m[v[1]] -= 1;
- }
- int maxx = -1, count = 0, ans;
- for(auto p: m){
- count += p.second;
- if(count > maxx){
- maxx = count;
- ans = p.first;
- }
- }
- return ans;
- }
- };
Advertisement
Add Comment
Please, Sign In to add comment