Given an integer array arr of size N, the task is to divide it into two sets S1 and S2 such that the absolute difference between their sums is minimum and find the minimum difference
- Time : O(n * sum)
- Space : O(sum)
c++
1 | class Solution{ |
if problem do not have duplicate numbers
Time : O(nlogn)
- Space : O(1)
c++
1 | class Solution{ |