Sum to N

Start Timer

0:00:00

Upvote
23
Downvote
Save question
Mark as completed
View comments (29)
Next question

Given a list of integers, and an integer N, write a function sum_to_n to find all combinations that sum to the value N.

Example: 

Input:

integers = [2,3,5]
N = 8

Output:

def sum_to_n(integers, N) ->
 [
  [2,2,2,2],
  [2,3,3],
  [3,5]
]
.
.
.
.
.


Comments

Loading comments