O69
Matchsticks to Square
Problem Statement & Objective
You are given an integer array matchsticks. Return True if you can make this array into a square by using all matchsticks.
Function Signature (Python)
makesquare(matchsticks: list[int]) -> boolInput & Output Contract
Output Rule:True veya False.
System Constraints
1 <= kibritler.length <= 15
1 <= kibritler[i] <= 10^8Example Execution Walkthrough
kibritler = [1, 1, 2, 2, 2] -> toplam 8, kenar 2 -> [1,1], [2], [2], [2] -> True
kibritler = [3, 3, 3, 3, 4] -> toplam 16, ancak 4 kenara bölünemez -> FalseExample Test Scenarios (3)
Example 1
Input:
[[1,1,2,2,2]]Expected Output:
trueExample 2
Input:
[[3,3,3,3,4]]Expected Output:
falseExample 3: 4 Eşit Kibrit
Input:
[[5,5,5,5]]Expected Output:
true