feat(content): more test cases

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

View File

@@ -8,6 +8,24 @@ categories:
patterns:
- intervals
function_signature: "def insert(intervals: list[list[int]], newInterval: list[int]) -> list[list[int]]:"
test_cases:
visible:
- input: { intervals: [[1, 3], [6, 9]], newInterval: [2, 5] }
expected: [[1, 5], [6, 9]]
- input: { intervals: [[1, 2], [3, 5], [6, 7], [8, 10], [12, 16]], newInterval: [4, 8] }
expected: [[1, 2], [3, 10], [12, 16]]
- input: { intervals: [], newInterval: [5, 7] }
expected: [[5, 7]]
hidden:
- input: { intervals: [[1, 5]], newInterval: [2, 3] }
expected: [[1, 5]]
- input: { intervals: [[1, 5]], newInterval: [6, 8] }
expected: [[1, 5], [6, 8]]
- input: { intervals: [[3, 5], [12, 15]], newInterval: [6, 6] }
expected: [[3, 5], [6, 6], [12, 15]]
description: |
You are given an array of non-overlapping intervals `intervals` where `intervals[i] = [start_i, end_i]` represent the start and the end of the i<sup>th</sup> interval and `intervals` is sorted in ascending order by `start_i`. You are also given an interval `newInterval = [start, end]` that represents the start and end of another interval.