Matchsticks to Square

Medium · Backtracking · about 25 minutes

Asked at Google, Amazon, Meta, Microsoft.

matchsticks[i] is the length of the i-th matchstick. Using every matchstick exactly once (no breaking), can you form a square? Return true or false.

Related guides