Skip to content
LakeBench
ProblemsCommunityPricing
Sign inStart practicing

Non-Overlapping Intervals

Python data engineering interview problem. Difficulty: intermediate. Pattern: Intervals. About 14 minutes. Part of the Pro drill bank.

Minimum removals to make intervals non-overlapping. Treat this as a production helper: match the contracted return shape, including empty and duplicate inputs.

Implement erase_overlap_intervals(intervals: list) -> int.

Constraints

  • Touching endpoints do not overlap.
  • Return removal count, not the kept list.

Examples

Input: erase_overlap_intervals([[1, 2], [2, 3], [3, 4], [1, 3]]) Output: 1 Remove [1,3].

Topics: lakebench, python, greedy, erase.

More Python interview questions · All interview problems · Learn data engineering

intermediate

Non-Overlapping Intervals

Interview-style drill: Minimum removals to make intervals non-overlapping.

Implement `erase_overlap_intervals(intervals: list) -> int`. Example: `[[1, 2], [2, 3], [3, 4], [1, 3]]` → `1`. Keep the harness.