int compare(int a, int b) {
string s = Integer.tostring(a);
string y = Integer.tostring(b);
if (s +y < y+s)
return -1;
else
return 1;
}
use this to write quick sort , you can get the answer.
On Fri, Aug 12, 2011 at 8:34 PM, Yasir Imteyaz <[email protected]> wrote:
> An array of integers is given and you have to find the largest possible
> integer by concatenating all elements:
>
> example:
> array: 87 36 52
> answer: 875236
>
> array: 87 9 52
> answer: 98752
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/algogeeks/-/_lJJOlRG_ukJ.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>
--
stay hungry stay foolish
Chengjie Qi
--
You received this message because you are subscribed to the Google Groups
"Algorithm Geeks" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/algogeeks?hl=en.