feat(content): function signatures + test cases
This commit is contained in:
@@ -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`.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user