gary@interview:~/interview/coding/729-my-calendar-i.md$
$ cat ./coding/729-my-calendar-i.md
[Coding]

729. My Calendar I

────────────────────────────────────────────────────────────

729. My Calendar I

插入時間的結束時間比當前時間的開始時間小,且插入時間的開始時間比當前的結束時間小 -> 發生重疊。

class MyCalendar(object):
    def __init__(self):
        self.calendar = []

    def book(self, start, end):
        for s, e in self.calendar:
            if s < end and start < e:
                return False
        self.calendar.append((start, end))
        return True


# Your MyCalendar object will be instantiated and called as such:
# obj = MyCalendar()
# param_1 = obj.book(start,end)

--tags#Classic
$ ls ./coding/ | grep -v 729-my-calendar-i
265. Paint House II256. Paint House143. Reorder List1762. Buildings With an Ocean View
← cd ../codingcd ~