How can we generate all the possible combinations of n characters with length 1 to n in an increasing order of length?
For Example : if n = 4 and characters are 1,2,3,4 we need to generate an array
1,2,3,4
12,13,14,23,24,34
123, 124, 134, 234
1234
Here n is the variable and user can feed the n characters.
nchoosek('1234', k)
with a loop onk
- Luis MendoC++
tag. Also, people will probably ask what you have tried. You should show your code and where you got stuck or why it doesn't work - Luis Mendonchoosek
in the answer here. - beaker