Question: Given a set of "n" non-negative integers, and a value "sum", determine if there is a subset of the given set with sum equal to given sum.
Input Format: 1st Line: n sum 2nd Line: a1 a2……an (Array Values)
Constraints: 1<= n <= 5000 1<= sum <= 10^7 1<= Ai <=10^5
Output Format: Yes, if sum exist No, it sum does not exist
I wanted to use this https://www.geeksforgeeks.org/dynamic-programming-subset-sum-problem/ solution But creating an array dp[5000+1][10e7+1] is not possible. So what can be done?