파비의 매일매일 공부기록

Today's Challenge 본문

Problem Solving/LeetCode

Today's Challenge

fabichoi 2022. 8. 3. 23:45

https://leetcode.com/problems/my-calendar-i/

 

My Calendar I - LeetCode

Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview.

leetcode.com

단순 구현 문제.. 그닥 어려운 건 없었음.

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

    def book(self, start, end):
        for i, j in self.booking:
            if i < end and start < j:
                return False
        self.booking.append((start, end))
        return True
반응형

'Problem Solving > LeetCode' 카테고리의 다른 글

Today's Challenge  (0) 2022.08.05
Today's Challenge  (0) 2022.08.04
Today's Challenge  (0) 2022.08.02
Today's Challenge  (0) 2022.08.01
Today's Challenge  (0) 2022.07.31
Comments