feat(content): more test cases

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

View File

@@ -11,6 +11,24 @@ patterns:
- two-pointers
- monotonic-stack
function_signature: "def trap(height: list[int]) -> int:"
test_cases:
visible:
- input: { height: [0, 1, 0, 2, 1, 0, 1, 3, 2, 1, 2, 1] }
expected: 6
- input: { height: [4, 2, 0, 3, 2, 5] }
expected: 9
hidden:
- input: { height: [0, 0, 0] }
expected: 0
- input: { height: [3, 0, 3] }
expected: 3
- input: { height: [1, 2, 3, 4, 5] }
expected: 0
- input: { height: [5, 4, 1, 2] }
expected: 1
description: |
Given `n` non-negative integers representing an elevation map where the width of each bar is `1`, compute how much water it can trap after raining.