Matchsticks to Square
Try to solve the Matchsticks to Square problem.
We'll cover the following
Statement
Given an integer array, matchsticks
, where matchsticks[i]
is the length of the matchstick. Use every single matchstick to create a square. No stick should be broken, although they can be connected, and each matchstick can only be used once.
Return TRUE if we can make this square and FALSE otherwise.
Constraints:
-
matchsticks.length
-
matchsticks[i]
Examples
Create a free account to view this lesson.
Continue your learning journey with a 14-day free trial.
By signing up, you agree to Educative's Terms of Service and Privacy Policy