feat(content): function signatures + test cases

This commit is contained in:
2025-07-13 19:53:34 +01:00
parent d65ccf7dc2
commit 0262ca8bf6
203 changed files with 4526 additions and 0 deletions

View File

@@ -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*.