Back to Back
A medium Python interview practice problem on DataDriven. Write and execute real python code with instant grading.
- Domain
- Python
- Difficulty
- medium
- Seniority
- L5
Problem
A maintenance-window export hands you a list of `[start, end]` pairs in `intervals`, and many of them overlap or sit back to back. Collapse each group of touching ranges into a single span that runs from the earliest start to the latest end of the group, where two ranges count as touching even when one only begins exactly where another finishes. Return the cleaned spans as `[start, end]` lists ordered by start, and give back an empty list when the input is empty.
Summary
Windows stacked on windows. Find the real spans.
Practice This Problem
Solve this Python problem with real code execution. DataDriven runs your Python code in a real environment and grades it automatically.