Skip to content

Commit 65894a4

Browse files
authored
Create 729. My Calendar I.cpp
1 parent 6ad92d4 commit 65894a4

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

C++/729. My Calendar I.cpp

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
class MyCalendar {
2+
public:
3+
MyCalendar() {}
4+
5+
bool book(int start, int end) {
6+
for(auto& x: v)
7+
if(start >= x[0] && start < x[1] || end > x[0] && end <= x[1] || start < x[0] && end > x[1]) return false;
8+
v.push_back({start, end});
9+
return true;
10+
}
11+
12+
private:
13+
vector<vector<int>>v;
14+
};

0 commit comments

Comments
 (0)