Employee Free Time — control flow
flowchart TD
S["<b>i · flatten</b><br/>all = schedule.flat()"]
--> T["<b>ii · sort by start</b>"]
--> M["<b>iii · merge</b><br/>(standard Merge Intervals)"]
--> G["<b>iv · gap walk</b><br/>for i in 1…len(merged)-1:<br/>free.append([merged[i-1][1], merged[i][0]])"]
--> R["<b>return</b> free"]
classDef start fill:#f5efe1,stroke:#6a8a4f,stroke-width:2px,color:#1a1915;
classDef action fill:#e7efd9,stroke:#587640,stroke-width:2px,color:#1a1915;
class S start
class T,M,G,R action-
Flatten
Collapse the per-employee lists into one big list of intervals.
-
Sort by start
Prep for the merge step — overlaps must be adjacent.
-
Merge intervals
Same Merge Intervals template — extend last bucket on overlap, otherwise push a new one.
-
Gap walk
For consecutive merged intervals, the gap `[prev.end, next.start]` is a free-time window.
Comments
Comments are disabled in this environment. Set
PUBLIC_GISCUS_REPO,PUBLIC_GISCUS_REPO_ID, andPUBLIC_GISCUS_CATEGORY_IDto enable.