@$ the ans should be 9823191 and not 98231910

On Sat, Aug 13, 2011 at 12:59 PM, Nikhil Veliath <nve...@gmail.com> wrote:
> @$ did not understand how the original array is sorted to give the number!
>
> On Sat, Aug 13, 2011 at 12:50 PM, *$* <gopi.komand...@gmail.com> wrote:
>> 1.scan the array and find the maximum digits of integer. lets say m..
>> 2.Again scan the array and pad the intergers whose digits are less that m (<
>> m) with zero's .. copy the new integers in a new array
>> 3.sort the new array in desc order and carry the same even for original
>> array.
>> 4. Now the original array contains the required output.
>> ex: original aarray 23,8,19,9,1
>>
>> max digits : 2 (for 23 as well as 19)
>> step 2: new array 23,80,19,90,10
>> step3. sort .. 90,80,23,19,10 .. and corresponding original is .. 98231910.
>>
>> original array contains the original output..
>>
>>
>>
>> On Sat, Aug 13, 2011 at 7:15 AM, chengjie qi <starboy...@gmail.com> wrote:
>>>
>>> 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 <yasir....@gmail.com>
>>> 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 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.
>>>
>>>
>>>
>>> --
>>> 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 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.
>>
>>
>>
>> --
>> Thx,
>> --Gopi
>>
>> --
>> 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