https://github.com/umarquez/summing_nums
This code extracts all the combinations of a list of numbers which sums the given total
https://github.com/umarquez/summing_nums
Last synced: about 1 year ago
JSON representation
This code extracts all the combinations of a list of numbers which sums the given total
- Host: GitHub
- URL: https://github.com/umarquez/summing_nums
- Owner: umarquez
- License: unlicense
- Created: 2020-02-03T19:45:37.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2020-02-05T04:09:14.000Z (over 6 years ago)
- Last Synced: 2025-02-09T04:25:44.019Z (over 1 year ago)
- Language: Go
- Size: 13.7 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# summing_nums
This code extracts all the combinations of a list of numbers which sums the given total
## Problem
Write a function which would take two variables as input
- Variable 1(a list of numbers) - example [1, 2, 4, 7, 9, 11]
- Variable 2(a target number) - example 11
- Output - Return a list of all the combinations of numbers given in input 1 which adds up to target. The result of the above inputs would be [[4,7], [9,2], [11]].
### More examples:
- Input :- Variable 1 = [-1, 2, 5, 6] , Variable 2 = 5; Output = [[-1,6], [5]]
- Input :- Variable 1 = [1,4,5] Variable 2 = [13]; Output = None
## Assumptions:-
For simplicity assume the below :
- The list in input variable 1 contains only integers.