feat(content): function signatures + test cases
This commit is contained in:
@@ -10,6 +10,30 @@ categories:
|
||||
patterns:
|
||||
- two-pointers
|
||||
|
||||
function_signature: "def check_arithmetic_subarrays(nums: list[int], l: list[int], r: list[int]) -> list[bool]:"
|
||||
|
||||
test_cases:
|
||||
visible:
|
||||
- input: { nums: [4, 6, 5, 9, 3, 7], l: [0, 0, 2], r: [2, 3, 5] }
|
||||
expected: [true, false, true]
|
||||
- input: { nums: [-12, -9, -3, -12, -6, 15, 20, -25, -20, -15, -10], l: [0, 1, 6, 4, 8, 7], r: [4, 4, 9, 7, 9, 10] }
|
||||
expected: [false, true, false, false, true, true]
|
||||
hidden:
|
||||
- input: { nums: [1, 2, 3], l: [0], r: [2] }
|
||||
expected: [true]
|
||||
- input: { nums: [7, 7, 7, 7], l: [0], r: [3] }
|
||||
expected: [true]
|
||||
- input: { nums: [1, 2, 4], l: [0], r: [2] }
|
||||
expected: [false]
|
||||
- input: { nums: [5, 3], l: [0], r: [1] }
|
||||
expected: [true]
|
||||
- input: { nums: [1, 3, 3, 5], l: [0], r: [3] }
|
||||
expected: [false]
|
||||
- input: { nums: [10, 20, 30, 40, 50], l: [0, 1, 2], r: [4, 3, 4] }
|
||||
expected: [true, true, true]
|
||||
- input: { nums: [100, -100], l: [0], r: [1] }
|
||||
expected: [true]
|
||||
|
||||
description: |
|
||||
A sequence of numbers is called **arithmetic** if it consists of at least two elements, and the difference between every two consecutive elements is the same. More formally, a sequence `s` is arithmetic if and only if `s[i+1] - s[i] == s[1] - s[0]` for all valid `i`.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user