It's a problem where you're given an array A = (A1 A2 A3…An) of positive integers, and you need to find a subset of the array such that the sum of the elements in that subset is equal to some positive integers.
Given an array of non-negative integers and an integer sum, can you determine if there exists any subset in the array whose sum is equal to the given integer sum?
This approach is based on two cases- 1. Take last element & calculate sum = target sum - value of last element & elements remaining = size of array - 1.
1. Make a 2D array of size equal to (size of array + 1) * (target sum + 1) of boolean type. 2. The state dp[i][j] will be true if there is a subset of elements from A[0….i] with a sum value equal to j.