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

0% completed

Vote For New Content
There is a way simpler solution. Create a list [True] * 24. Iterate through all ...

Mike Xu

Oct 14, 2022

There is a way simpler solution. Create a list [True] * 24. Iterate through all the intervals of all employees and set the True to False whenever an employee is not free. At the end, the list will have True only on the intervals that are free for all employees. This solution has O(1) space complexity and O(N) time complexity.

3

0

Comments
Comments
B
Bora 3 years ago

Where did you get 24 from

B
Bora 3 years ago

I'm guessing it's because there are 24 hours in a day. Can you paste your code here please? I'm having trouble writing the code for this solution.

G
gentlerainsky 22 days ago

The max schedule end is 10^8. So your time and space complexity will explode.

On this page