feat(content): function signatures + test cases

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

View File

@@ -9,6 +9,26 @@ categories:
patterns:
- greedy
function_signature: "def flipgame(fronts: list[int], backs: list[int]) -> int:"
test_cases:
visible:
- input: { fronts: [1, 2, 4, 4, 7], backs: [1, 3, 4, 1, 3] }
expected: 2
- input: { fronts: [1], backs: [1] }
expected: 0
hidden:
- input: { fronts: [1, 2], backs: [2, 1] }
expected: 1
- input: { fronts: [2, 2], backs: [2, 2] }
expected: 0
- input: { fronts: [1, 1], backs: [1, 2] }
expected: 2
- input: { fronts: [5, 3, 7], backs: [5, 3, 8] }
expected: 7
- input: { fronts: [1, 2, 3], backs: [4, 5, 6] }
expected: 1
description: |
You are given two **0-indexed** integer arrays `fronts` and `backs` of length `n`, where the i<sup>th</sup> card has the positive integer `fronts[i]` printed on the front and `backs[i]` printed on the back. Initially, each card is placed on a table such that the front number is facing up and the other is facing down.