@daizi sheng

     Thanks for Ur ideas.  But in Ur solution how do  u fix the prefix.
ie., How did U choose 112 as the prefix in the number 11261.  Can
u pls provide the algo.

@Ajay

     U are correct.  for the first example I gave, I made a mistake.
So, I will define the problem again.  Sorry for that.  So the correct
requirement is

     the algo should give the largest number possible, but smaller
than the given number with a constraint  that the same combination
of digits are to be used.  It is true that for some numbers this may
not be possible

                   for 321 the output should be 312
                   for 5342 the output should be 5324
                   for 11261 the output should be 11216


--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/algogeeks
-~----------~----~----~----~------~----~------~--~---

Reply via email to