My Calendar I LeetCode solution in C++
1class MyCalendar {2public:3vector<pair<int, int>> cal;4MyCalendar() {}56bool book(int start, int end) {7for (int i = 0; i < cal.size(); i++) {8if (end <= cal[i].first || start >= cal[i].second)9continue;10else11return false;12}13cal.push_back({start, end});14return true;15}16};