Posts

Showing posts from July, 2022

Subset Sum with Recursion | memorization | DP

Given a set of non-negative integers, and a value sum , determine if there is a subset of the given set with sum equal to given sum . https://www.geeksforgeeks.org/subset-sum-problem-dp-25/             Recursion                                            class Solution {          static boolean isSumK(int[] nums, int curin, int curSum) {                  if(curSum==0) {             return true;         }                  if(curin<0) {             return false;     ...