Return True if the numbers in nums can be split into two groups with the same sum.
For [1, 5, 11, 5] the answer is True (11 and 1 + 5 + 5); for [1, 2, 3, 5] it is False.
The starter code tries to include or skip every number. It is correct but too slow on inputs without an answer.
Example 1
Input:
can_partition([1, 5, 11, 5])
Output:
True
Example 2
Input:
can_partition([1, 2, 3, 5])
Output:
False
0 <= len(nums) <= 2001 <= nums[i] <= 100No results yet
Run your code to check it against the examples, or submit to run every test.