Grokking the Coding Interview: Patterns for Coding Questions
Ask Author
Back to course home

0% completed

Vote For New Content
Mohammed Dh Abbas
O(N) time / O(1) Space solution

Mohammed Dh Abbas

Aug 24, 2024

class Solution: def book(self, nums): result = [] # to track the booked times b_start, b_end = float('inf'), float('-inf') for start, end in nums: if start >= b_end or end <= b_start: b_start = min(start, b_start) b_end = max(b_end, end) result.append(True) else: result.append(False) return result

0

1

Comments
Comments

On this page