+ 1
Write a recursive function to print all permutations of given digits(1,2,3,4,...,N)
Can anyone code this ?
9 Answers
+ 11
i like the challenge
//will make code later âș (java)
+ 4
Explanation?
+ 3
What do you mean by "permutations'. Kindly give a sample input and expected output
+ 3
ook
+ 2
I meant could you explain what you want?
+ 1
yes, please!
+ 1
I need the code of that question
+ 1
input: 1,2,3
output:
123
132
213
231
312
321
+ 1
I think you want like this but it is Python and using generator. I saw it on internet.
def permu(x):
if len(x) == 1:
yield x
else:
for i in range(len(x)):
for p in permu(x[:i] + x[i+1:]):
yield [x[i]] + p
print(list(permu([1,2,3])))