@Naveen:
Here's a counter case:

162, 16
The next digit(2) is not greater than the last equal digit(6), still 162
comes before 16.

Here, as is done in ashu's algo, the next digit (2) should be compared with
first digit(1) and not the last equal digit(6).

Cheers
Nikhil Jindal
http://sites.google.com/site/aboutnikhiljindal/

On Mon, May 30, 2011 at 12:43 PM, Naveen Agrawal <nav.coo...@gmail.com>wrote:

> @ shubham
>
> Your solution need some changes at step 2
>
> step 1:
>        sort the given numbers in the decreasing order based on their first
> digit(left most).
>
> step 2:
>        if two numbers come out to be equal in the above case & both of
> their next digit exist then sort on the basis of their next digit,
>        otherwise,
>        the number whose next digit *is greater than last equal digit will
> come first.(i.e, n=10 m=108  ,as next digit(n->0,m->8) is greater than last
> equal digit(0), so 108 will come first ) *
>
>
>
> Naveen
>
> --
> 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.
>

-- 
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