feat(content): function signatures + test cases
This commit is contained in:
@@ -9,6 +9,26 @@ categories:
|
||||
patterns:
|
||||
- greedy
|
||||
|
||||
function_signature: "def array_pair_sum(nums: list[int]) -> int:"
|
||||
|
||||
test_cases:
|
||||
visible:
|
||||
- input: { nums: [1, 4, 3, 2] }
|
||||
expected: 4
|
||||
- input: { nums: [6, 2, 6, 5, 1, 2] }
|
||||
expected: 9
|
||||
hidden:
|
||||
- input: { nums: [1, 2] }
|
||||
expected: 1
|
||||
- input: { nums: [1, 1, 1, 1] }
|
||||
expected: 2
|
||||
- input: { nums: [-1, -2, -3, -4] }
|
||||
expected: -6
|
||||
- input: { nums: [-5, 5, -3, 3] }
|
||||
expected: -2
|
||||
- input: { nums: [1, 2, 3, 4, 5, 6] }
|
||||
expected: 9
|
||||
|
||||
description: |
|
||||
Given an integer array `nums` of `2n` integers, group these integers into `n` pairs `(a1, b1), (a2, b2), ..., (an, bn)` such that the sum of `min(ai, bi)` for all `i` is **maximised**.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user