feat(content): function signatures + test cases

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

View File

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