Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class MyCalendarThree {
- public:
- map<int, int> time;
- MyCalendarThree() {
- }
- int book(int start, int end) {
- time[start]++;
- time[end]--;
- int ans=0, current=0;
- for(auto t: time)
- ans = max(ans, current+=t.second);
- return ans;
- }
- };
- /**
- * Your MyCalendarThree object will be instantiated and called as such:
- * MyCalendarThree* obj = new MyCalendarThree();
- * int param_1 = obj->book(start,end);
- */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement