feat(content): function signatures + test cases
This commit is contained in:
@@ -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**.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user