check this
http://groups.google.com/group/algogeeks/browse_thread/thread/1f8e78e3a4a95588/5f043389841ba7d1?q=next+highest+number&rnum=1#5f043389841ba7d1
On 11/30/05, sai ram <[EMAIL PROTECTED]> wrote:
>
>
> Hi,
> Can someone describe me a solution to this good problem ? How do you
> solve it ? I h
How about this:
The only reversals that increase the price are 2 --> 5 and 6 --> 9.
We traverse from right-most digit to left-most digit and see if it's a
2 or a 5, if it is, then we reverse and thus we get the probable next
max value.
Next we sort the digits present in the number and for each