+ 1

I want to create combination of three digits.

https://code.sololearn.com/cz8JsLlSAgFi/?ref=app for example when we enter 123,answer will be 312,231,321,132,213. problem is that i want 6 answer but when i set limit to 6 it starts get duplicating

3rd Sep 2018, 7:27 AM
Vivek Mishra
Vivek Mishra - avatar
2 Respuestas
+ 8
Looks like you want to permute a string. There is an implementation in Java of a permutation function here: https://www.geeksforgeeks.org/write-a-c-program-to-print-all-permutations-of-a-given-string/
3rd Sep 2018, 7:42 AM
Eduardo Petry
Eduardo Petry - avatar
0
Vivek Mishra what is the problem with u in this program??? Can u give all variable description so it wll be easy to solve ur problem!!! This is too complicates as another way i have i. take a fuction nd take a number as in argument and by using loop reverse it nd display dat ii. when u call main method take another loop nd run it three time nd reverse the no again n display it n den call a above method dat u take... // hope this help nd one suggestion in ur program dat u have take d last no to its first nd first two no as last dats the main problem so when the loop run 2 time correctly den again it wll do dat again so the no remain same so fix it as half of the hint i give!!!!!
3rd Sep 2018, 1:55 PM
Harsh Agrawal
Harsh Agrawal - avatar