Print all possible combinations with repitition from an array or list of size N using recursion | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Print all possible combinations with repitition from an array or list of size N using recursion

example: N=3 array [1,2,3] 111 112 113 121 122 ... number will be given by the user

17th Feb 2017, 5:10 PM
Mohd Shahid Ameen
Mohd Shahid Ameen - avatar
2 Answers
+ 2
17th Feb 2017, 5:59 PM
Akshata
Akshata - avatar
0
I wrote a program that does exactly this in Python some time back. It was rather inefficient due to the use of recursion, though. There are better algorithms that don't use recursion.
21st Feb 2017, 9:17 AM
मानस