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 if a sub...read more
Help your peers!
Add answer anonymously...
PayPal Software Developer interview questions & answers
A Software Developer was asked 7mo agoQ. Given a list and a series of queries, how would you efficiently sort the list af...read more
A Software Developer was asked Q. Given an array of numbers, find a subset of numbers that sum to zero.
A Software Developer was asked Q. Explain how BFS works.
Popular interview questions of Software Developer
A Software Developer was asked 8mo agoQ1. Given a list and a series of queries, how would you efficiently sort the list af...read more
A Software Developer was asked Q2. Given an array of numbers, find a subset of numbers that sum to zero.
A Software Developer was asked Q3. Explain how BFS works.
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

