starting from right find first digit less then right most digit,if no any
digit is less,then move to next right most and compair ,,,,when found
exchange those no,
now sort the no.s up to that index of the given no which is exchanged:
Ex:
43987723893239876
first required sequence: 439877238932[3]987[6] swap these no
439877238932[6]{987[3]}
now sort in decreasing order  439877238932[6]{3789} this is the required no
....correct me if any thing wrong

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.

Reply via email to