Subset Sum Problem (Recursive Solution)
Sun Feb 06 2022 22:16:26 GMT+0000 (Coordinated Universal Time)
Saved by @Uttam #java #gfg #geeksforgeeks #lecture #recursion #subsetsum
Subsets of [1,2,3] are [], [1], [2], [3], [1,2], [1,3], [2,3], [1,2,3] Example 1: Input: N = 6 arr[] = {3, 34, 4, 12, 5, 2} sum = 9 Output: 1 Explanation: Here there exists a subset with sum = 9, 4+3+2 = 9. Example 2: Input: N = 6 arr[] = {3, 34, 4, 12, 5, 2} sum = 30 Output: 0 Explanation: There is no subset with sum 30.
Comments