Answer the question
In order to leave comments, you need to log in
C++ compose all possible combinations of a string from numbers, with a certain length?
We need to make an algorithm in C++ to make all combinations of numbers in the range from 1 to N, with a certain length K.
Sample input:
N = 2
K = 2
Sample output:
11
12
21
22
Answer the question
In order to leave comments, you need to log in
If I have not forgotten the combinatorics, then this is an arrangement with repetitions from N to K. The implementation in Google is quietly looking for.
https://prog-cpp.ru/placement/
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question