S
All challenges
Practice
Home
Blog
Practice
Examples
Feedback
Subset Sum Problem
00:00
Start
00:00
Sign in
Problem
Hints
3
Solution
History
Medium
Dynamic Programming
Knapsack
Amazon
TCS
Flipkart
Determine if there exists a subset of the array that sums to a given target value.
Examples
Example 1
Input →
[3,34,4,12,5,2], target=9
Output →
True
Note:
4+5 or 2+3+4
Example 2
Input →
[3,34,4,12,5,2], target=30
Output →
False
Example 3
Input →
[1,1,1,1], target=2
Output →
True
JavaScript
Python
Java (Coming soon)
C (Coming soon)
C++ (Coming soon)
Reset
Run
Submit
Cases
Results