feat(content): function signatures + test cases
This commit is contained in:
@@ -10,6 +10,32 @@ categories:
|
||||
patterns:
|
||||
- greedy
|
||||
|
||||
function_signature: "def can_reorder_doubled(arr: list[int]) -> bool:"
|
||||
|
||||
test_cases:
|
||||
visible:
|
||||
- input: { arr: [3, 1, 3, 6] }
|
||||
expected: false
|
||||
- input: { arr: [2, 1, 2, 6] }
|
||||
expected: false
|
||||
- input: { arr: [4, -2, 2, -4] }
|
||||
expected: true
|
||||
hidden:
|
||||
- input: { arr: [1, 2, 4, 8] }
|
||||
expected: true
|
||||
- input: { arr: [0, 0] }
|
||||
expected: true
|
||||
- input: { arr: [0, 0, 0, 0] }
|
||||
expected: true
|
||||
- input: { arr: [-2, -4] }
|
||||
expected: true
|
||||
- input: { arr: [-1, -2, -4, -8] }
|
||||
expected: true
|
||||
- input: { arr: [1, 2, 1, 2] }
|
||||
expected: true
|
||||
- input: { arr: [1, 3] }
|
||||
expected: false
|
||||
|
||||
description: |
|
||||
Given an integer array of even length `arr`, return `true` *if it is possible to reorder* `arr` *such that* `arr[2 * i + 1] = 2 * arr[2 * i]` *for every* `0 <= i < len(arr) / 2`, *or* `false` *otherwise*.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user