We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent c6c6442 commit 4b69e9eCopy full SHA for 4b69e9e
algorithms/intervals/employee_free_time/__init__.py
@@ -70,11 +70,16 @@ def employee_free_time_heap(schedules: List[List[Interval]]) -> List[Interval]:
70
# and add start of each schedule's first interval along with
71
# its index value and a value 0.
72
for i in range(len(schedules)):
73
- heap.append((schedules[i][0].start, i, 0))
+ if schedules[i]: # Only add if employee has at least one interval
74
+ heap.append((schedules[i][0].start, i, 0))
75
76
# Create heap from array elements.
77
heapq.heapify(heap)
78
79
+ # Handle empty heap
80
+ if not heap:
81
+ return []
82
+
83
# Take an empty array to store results.
84
free_time_slots = []
85
0 commit comments