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,30 @@ categories:
patterns:
- backtracking
function_signature: "def makesquare(matchsticks: list[int]) -> bool:"
test_cases:
visible:
- input: { matchsticks: [1, 1, 2, 2, 2] }
expected: true
- input: { matchsticks: [3, 3, 3, 3, 4] }
expected: false
hidden:
- input: { matchsticks: [1, 1, 1, 1] }
expected: true
- input: { matchsticks: [1, 2, 3] }
expected: false
- input: { matchsticks: [5, 5, 5, 5, 4, 4, 4, 4, 3, 3, 3, 3] }
expected: true
- input: { matchsticks: [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1] }
expected: false
- input: { matchsticks: [2, 2, 2, 2, 2, 2, 2, 2] }
expected: true
- input: { matchsticks: [10] }
expected: false
- input: { matchsticks: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15] }
expected: true
description: |
You are given an integer array `matchsticks` where `matchsticks[i]` is the length of the i<sup>th</sup> matchstick. You want to use **all the matchsticks** to make one square. You **should not break** any stick, but you can link them up, and each matchstick must be used **exactly one time**.