feat(content): function signatures + test cases

This commit is contained in:
2025-07-13 19:53:34 +01:00
parent 9e6c6d256f
commit 65a8d525f5
203 changed files with 4526 additions and 0 deletions

View File

@@ -10,6 +10,28 @@ patterns:
- sliding-window
- prefix-sum
function_signature: "def num_subarrays_with_sum(nums: list[int], goal: int) -> int:"
test_cases:
visible:
- input: { nums: [1, 0, 1, 0, 1], goal: 2 }
expected: 4
- input: { nums: [0, 0, 0, 0, 0], goal: 0 }
expected: 15
hidden:
- input: { nums: [1, 1, 1, 1, 1], goal: 3 }
expected: 3
- input: { nums: [1, 0, 0, 0, 1], goal: 1 }
expected: 8
- input: { nums: [0, 1, 0], goal: 1 }
expected: 4
- input: { nums: [1], goal: 1 }
expected: 1
- input: { nums: [0], goal: 0 }
expected: 1
- input: { nums: [1, 1, 1], goal: 5 }
expected: 0
description: |
Given a binary array `nums` and an integer `goal`, return *the number of non-empty **subarrays** with a sum equal to* `goal`.