Task: merge overlapping intervals
# Task: merge overlapping intervals
## Deliverable
Implement `merge_intervals(intervals: list[list[int]]) -> list[list[int]]` in
`merge_intervals.py`.
## Spec
- Each interval is `[start, end]` with `start <= end` (integers).
- Merge all overlapping or **touching** intervals (e.g. `[1,2]` and `[2,3]` → `[1,3]`).
- Return merged intervals sorted by start ascending.
- Empty input → `[]`.
- Do not mutate the caller's list (return a new list).
- Invalid shapes are out of scope (tests only pass well-formed intervals).
## Constraints
- Stdlib only; edit only the starter tree; no hidden-test edits.
## Done means
Function matches the spec; note verification.when to use it
Community prompt sourced from the open-source GitHub repo TinkerandScribe/gxp (MIT). A "Task: merge overlapping intervals" style prompt — adapt the placeholders and specifics to your task. Imported as-is and not independently retested here, so check the output before relying on it.
tags
productivitycommunitydeveloper
source
TinkerandScribe/gxp · MIT
more in Productivity
Productivity✓ tested
Summarize a doc into decisions & actions
chief of staff who extracts what to DO, not just what was said
Productivity✓ tested
Draft a reply to a hard email
calm, direct communicator who de-escalates without caving
Productivity✓ tested
Turn a brain-dump into a weekly plan
planning coach who protects your focus, not just your calendar