sides
with four zeros, representing the current length of each side.dfs
that takes the index of the current matchstick and the sides
array.sides
array, try to place the current matchstick on it.dfs
with the next index and updated sides
.dfs
function starting with the first matchstick.