Skip to content

Commit 5d77174

Browse files
Update Minimum sum partition
Added some test cases for better understanding.
1 parent b1caf8c commit 5d77174

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

DynamicProgramming/Minimum sum partition

+14
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,19 @@
11
// Partition a set into two subsets such that the difference of subset sums is minimum
22

3+
/*
4+
Input: arr[] = {1, 6, 11, 5}
5+
Output: 1
6+
Explanation:
7+
Subset1 = {1, 5, 6}, sum of Subset1 = 12
8+
Subset2 = {11}, sum of Subset2 = 11
9+
10+
Input: arr[] = {36, 7, 46, 40}
11+
Output: 23
12+
Explanation:
13+
Subset1 = {7, 46} ; sum of Subset1 = 53
14+
Subset2 = {36, 40} ; sum of Subset2 = 76
15+
*/
16+
317
import java.util.*;
418
import java.lang.*;
519
import java.io.*;

0 commit comments

Comments
 (0)