How can we take a number and make the smallest number rearranging the digits of it? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

How can we take a number and make the smallest number rearranging the digits of it?

19th Mar 2018, 7:20 AM
Golnaz Mesbahi
Golnaz Mesbahi - avatar
4 Answers
+ 12
Yes , it can be done without using lists ☺ LukaArToDo posted a challenge on that Or U can search my codes [made it in java] //might there U will find python codes for that .. take idea from that .
19th Mar 2018, 8:10 AM
Gaurav Agrawal
Gaurav Agrawal - avatar
+ 7
sort it in ascending order e.g. If number is 3120 Smallest from it: 0123
19th Mar 2018, 8:11 AM
Kartikey Sahu
Kartikey Sahu - avatar
+ 4
can this be done without the use of 'list'?
19th Mar 2018, 8:05 AM
Golnaz Mesbahi
Golnaz Mesbahi - avatar