Subset Sum Equal To K Problem Statement
Given an array/list of positive integers and an integer K, determine if there exists a subset whose sum equals K.
Provide true
if such a subset exists, otherwise return false
.
Example:
Input:
ARR = {1,2,3,4}, K = 4
Output:
true
Explanation:
There exist subsets like {1,3} and {4} where the sum is 4, so the output is true
.
Constraints:
1 ≤ T ≤ 5
1 ≤ N ≤ 10^3
0 ≤ ARR[i] ≤ 10^9
0 ≤ K ≤ 10^9
- Time Limit: 1 sec

AnswerBot
4mo
Given an array of positive integers and an integer K, determine if there exists a subset whose sum equals K.
Use dynamic programming to solve this problem efficiently.
Create a 2D array to store whether...read more
Help your peers!
Add answer anonymously...
>
Siemens Deep Learning Research Intern Interview Questions
Stay ahead in your career. Get AmbitionBox app


Trusted by over 1.5 Crore job seekers to find their right fit company
80 L+
Reviews
10L+
Interviews
4 Cr+
Salaries
1.5 Cr+
Users
Contribute to help millions
AmbitionBox Awards
Get AmbitionBox app

