diff options
author | Jack Sangdahl <[email protected]> | 2025-06-27 12:23:02 -0600 |
---|---|---|
committer | Jack Sangdahl <[email protected]> | 2025-06-27 12:23:02 -0600 |
commit | a96b65cbfad7f62f3db6b2eab105e4e25c0414c5 (patch) | |
tree | e2a2b3f49f9fb741be81415266ac93e74cff42ec /other/my_calendar.cpp | |
parent | 694ad5ed71edcb1deccab54b72d706b779918276 (diff) | |
download | leetcode-a96b65cbfad7f62f3db6b2eab105e4e25c0414c5.tar.gz leetcode-a96b65cbfad7f62f3db6b2eab105e4e25c0414c5.zip |
chore: remove old cpp and rust solutions
Diffstat (limited to 'other/my_calendar.cpp')
-rw-r--r-- | other/my_calendar.cpp | 31 |
1 files changed, 0 insertions, 31 deletions
diff --git a/other/my_calendar.cpp b/other/my_calendar.cpp deleted file mode 100644 index 472884e..0000000 --- a/other/my_calendar.cpp +++ /dev/null @@ -1,31 +0,0 @@ -// 729. My Calendar I -#include "leetcode.h" - -/* - * you are implementing a program to use as your calendar. we can add a new - * event if adding the event will not cause a double booking. a double booking - * happens when two events have some non empty intersection (ie. some moment is - * common to both events.). the event can be represented as a pair of integers - * 'start' and 'end' that represent a booking on the half open interval '[start, - * end)', the range of real numbers 'x' such that 'start <= x < end'. - */ - -class MyCalendar { - vector<pair<int, int>> books; - -public: - bool book(int start, int end) { - for (pair<int, int> p : books) - if (max(p.first, start) < min(end, p.second)) - return false; - books.push_back({start, end}); - return true; - } -}; - -int main() { - MyCalendar *obj = new MyCalendar(); - printf("%d\n", obj->book(10, 20)); // expect: 1 - printf("%d\n", obj->book(15, 25)); // expect: 0 - printf("%d\n", obj->book(20, 30)); // expect: 1 -} |