Standard Bar Dynamic Programming · DP on Subsequences O(n*S) · O(S)
A gym equips two identical lockers and must split a shipment of weighted plates between them so both lockers carry exactly the same load. Plates are rigid — no splitting in half. The intake scanner answers one question per shipment: can the plates be divided into two perfectly balanced groups?
Input: An array nums of n positive integers.
Output: Return true if nums can be split into two subsets with equal sums, otherwise false.
1 <= n <= 2001 <= nums[i] <= 100Input: {"nums":[1,5,11,5]}
Output: true
Locker A takes 11; locker B takes 1 + 5 + 5 = 11.
Input: {"nums":[1,2,3,5]}
Output: false
The total 11 is odd, so equal halves are impossible.