https://leetcode.com/problems/matchsticks-to-square/


Time Limit Exceeded


```python
class Solution:
    def makesquare(self, matchsticks: List[int]) -> bool:
        #8:51
        self.ok = False
        def trying(a,b,c,d,left):
            if self.ok:
                return True
            if len(left) == 0:
                if sum(a) == sum(b) == sum(c) == sum(d):
                    self.ok = True
                    return True
                else:
                    return False
                
            one = left[0]
            return any([
                trying(a+[one],b,c,d,left[1:]),
                trying(a,b+[one],c,d,left[1:]),
                trying(a,b,c+[one],d,left[1:]),
                trying(a,b,c,d+[one],left[1:])
            ])
        return trying([],[],[],[],matchsticks)
        #8:59
```
