Given an integer array nums, return true if you can partition the array into two subsets such that the sum of elements in both subsets is equal.
Example 1
Input: nums = [1,5,11,5]
Output: true
Explanation: The total is 22, so each half must sum to 11. [11] and [1,5,5] both sum to 11.
Example 2
Input: nums = [1,2,3,5]
Output: false
Explanation: The total is 11, which is odd, so it cannot be split into two equal halves.
Example 3
Input: nums = [1,1]
Output: true
Explanation: Put one 1 in each subset; both sum to 1.
Splitting `nums` into two subsets of equal sum is the same as picking a subset that sums to `total / 2`. (The complement automatically sums to the other half.) That's the classic 0/1 knapsack "can we hit target sum?" question. We track the *set of reachable subset-sums* as we add numbers one at a time.
Run checks all cases above. Submit evaluates all test cases.