List ways to reach a target sum - MATLAB Cody - MATLAB Central

Problem 47415. List ways to reach a target sum

Difficulty:Rate
Given a vector of integers, how many ways are there to achieve or exceed a target sum? For example, if the vector is [3 6 10 11 15 16 16 20] and the target is 43, then a solution that hits the target is [6 10 11 16], and a solution that exceeds the target is [6 10 11 16 16 20]. How many more solutions are possible?
Write a function that takes a vector and a target sum and returns a cell array of possible solutions. The order of the solutions in the cell array is not important.

Solution Stats

22.73% Correct | 77.27% Incorrect
Last Solution submitted on Jul 17, 2024

Problem Comments

Solution Comments

Show comments
Primes and Rough Numbers, Basic ideas
What is a rough number? What can they be used...
2
4

Problem Recent Solvers5

Suggested Problems

More from this Author291

Problem Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
Go to top of page