Given a vector v of integers and an integer n, return the the indices of v (as a row vector in ascending order) that sum to n. If there is no subset in v that sums to n, return an empty matrix []. You can assume that the answer will always be unique.
Example:
>> v = [2, 3, 5]; >> n = 8; >> subset_sum(v, n) ans = 2 3
Which values occur exactly three times?
2986 Solvers
Test if a Number is a Palindrome without using any String Operations
136 Solvers
Rotate input square matrix 90 degrees CCW without rot90
242 Solvers
Given a 4x4 matrix, swap the two middle columns
266 Solvers
236 Solvers
MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi
Learn moreOpportunities for recent engineering grads.
Apply Today