Skip to content

Commit

Permalink
Time: 134 ms (71.42%), Space: 37.7 MB (87.88%) - LeetHub
Browse files Browse the repository at this point in the history
  • Loading branch information
gkapelyushok committed Aug 3, 2022
1 parent ee010a6 commit 61edce3
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions 729-my-calendar-i/729-my-calendar-i.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
class MyCalendar {
public:
MyCalendar() {

}

bool book(int start, int end) {
for (auto c : cal) {
if (max(c.first, start) < min(c.second, end)) {
return false;
}
}
cal.push_back({start, end});
return true;
}

private:
vector<pair<int, int>> cal;
};

/**
* Your MyCalendar object will be instantiated and called as such:
* MyCalendar* obj = new MyCalendar();
* bool param_1 = obj->book(start,end);
*/

0 comments on commit 61edce3

Please sign in to comment.