```
def canPartition(self, nums):
all_sum = sum(nums)
if all_sum % 2 == 1:
return False
sums = set()
for num in nums:
sums.update([i + num for i in sums])
sums.add(num)
if all_sum / 2 in sums:
return True
return False
```