Answer the question
In order to leave comments, you need to log in
Python. Get the composition of an integer from N numbers?
Given numbers x and n > 0. You need to get all the ways in which you can express the number x as a sum of n numbers.
Example:
Input:
x = 6 n
= 2
Output:
1 + 5
2 + 4
3 + 2
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question