feat(content): more test cases

This commit is contained in:
2025-07-13 19:25:39 +01:00
parent e28da5def2
commit 0f264ef603
94 changed files with 1840 additions and 0 deletions

View File

@@ -9,6 +9,24 @@ categories:
patterns:
- intervals
function_signature: "def merge(intervals: list[list[int]]) -> list[list[int]]:"
test_cases:
visible:
- input: { intervals: [[1, 3], [2, 6], [8, 10], [15, 18]] }
expected: [[1, 6], [8, 10], [15, 18]]
- input: { intervals: [[1, 4], [4, 5]] }
expected: [[1, 5]]
- input: { intervals: [[1, 4], [0, 4]] }
expected: [[0, 4]]
hidden:
- input: { intervals: [[1, 4]] }
expected: [[1, 4]]
- input: { intervals: [[1, 4], [0, 0]] }
expected: [[0, 0], [1, 4]]
- input: { intervals: [[1, 4], [2, 3]] }
expected: [[1, 4]]
description: |
Given an array of `intervals` where `intervals[i] = [start_i, end_i]`, merge all overlapping intervals, and return *an array of the non-overlapping intervals that cover all the intervals in the input*.