0
i want an idea
if there is a array, consider 1, 2 ,4, 5, 6 and there is a value 7...u have to find how many ways u will get 7,,here (1,6),(2,5),(1,2,4)...... array can be of any size ....
1 Answer
+ 1
Arrange the array in ascending or descending order then take the biggest number among them, add the next element.
If there sum is greater than the value then next element if there sum is less than the value then add another element, if sum is equal print those numbers.
Continue the process with the next big number and so on.