Leetcode 473. Matchsticks to Square
Determine whether the matchsticks can be partitioned into four groups with equal total length (forming the four sides of a square) using every stick exactly once — return false if the total sum isn't divisible by 4 or any stick exceeds the target side length; with n ≤ 15 this is typically solved by backtracking/bitmask search.
Question Timeline
See when this question was last asked and where, including any notes left by other candidates.
Mid September, 2026
You are given an integer array matchsticks where matchsticks[i] is the length of the ith 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. Return true if you can make this square and false otherwise.
Hello Interview Premium
Your account is free and you can post anonymously if you choose.