Interview Query

Sum to N

17
Have you seen this question before?

Given a list of integers, and an integer N, write a function sum_to_n 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]
]
Next question: Promoting Instagram
.....
Python 3.9.6
Loading editor
Use Shift + Enter to run code