M
M
merkulov02019-10-18 12:21:45
C++ / C#
merkulov0, 2019-10-18 12:21:45

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

1 answer(s)
D
doublench21, 2019-10-18
@mmerkulov0

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 question

Ask a Question

731 491 924 answers to any question