729. 我的日程安排表 I
class MyCalendar {
vector<pair<int, int>> booked;
public:
MyCalendar() {
}
bool book(int start, int end) {
for (auto x : booked)
if (start < x.second && end > x.first)
return false;
booked.push_back({start, end});
return true;
}
};
/**
* Your MyCalendar object will be instantiated and called as such:
* MyCalendar* obj = new MyCalendar();
* bool param_1 = obj->book(start,end);
*/