Challenge | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 6

Challenge

Write a program to find the permutation of n , not all different things taking r at a time. Like , find the permutation with digits 7,6,7,8,9,8 taking 3 at a time. This question is not as easy as it seems, if it is asked taking all at a time (like, if there are 8, not all different things & we have to find permutation taking 8 at a time) then ,this becomes very easy(n!/(a!*b!....)) but here , this is not the case. Sample Input - 97897 3 Sample Output- Permutation of 97897 taking 3 at a time = 18

24th Mar 2018, 8:05 AM
Mr.Curious
Mr.Curious - avatar
4 Answers
+ 18
Sorry, I have not seen before. Thank you for the invitation. Here's my try : https://code.sololearn.com/cr202esYb0S5/?ref=app
9th May 2018, 7:58 AM
LukArToDo
LukArToDo - avatar
+ 19
RAHUL JAISWAL I tried to explain my approach in the comment section of my code 😉
9th May 2018, 9:11 AM
LukArToDo
LukArToDo - avatar
24th Mar 2018, 9:05 AM
Ulisses Cruz
Ulisses Cruz - avatar
+ 2
LukArToDo , Awesome frnd 🤞 It's my pleasure 😊, please share your Mathematical approach of doing this, I am just a Beginner in Kotlin.
9th May 2018, 8:17 AM
Mr.Curious
Mr.Curious - avatar