Dynamic Programming: Knapsack - Minimum Subset Sum Difference
The following code attempts to solve the minimum subset sum difference problem using space-optimized DP. Identify the bug:
```python
def min_subset_sum_diff(arr):
total_sum = sum(arr)
dp = [False] * (total_sum + 1)
for num in arr:
for w in range(num, total_sum + 1):
dp[w] = dp[w] or dp[w - num]
half = total_sum // 2
for w in range(half, -1, -1):
if dp[w]:
return total_sum - 2 * w
```
