@Aakash, yeah missed that, overriding default string comparator while sorting will do that.
On Fri, May 27, 2011 at 8:11 PM, Arpit Mittal <[email protected]>wrote: > @piyush : > > for 1, 100 > > you did > 100,100 > then sort > result 100,100 > > so u said ans is 1100 but it could also be 1001 as 100=100... > > correct me if i am wrong? > > > On Fri, May 27, 2011 at 7:39 AM, Aakash Johari <[email protected]>wrote: > >> @vipul: try for 100 and 10 >> >> >> 2011/5/27 • » νιρυℓ « • <[email protected]> >> >>> @Piyush Sinha, >>> what about 9, 801 >>> >>> 2011/5/27 • » νιρυℓ « • <[email protected]> >>> >>>> Take input as vector of string or array of string >>>> sort the vector >>>> print from end to beginning >>>> >>>> >>>> On Fri, May 27, 2011 at 7:51 PM, Logic King <[email protected] >>>> > wrote: >>>> >>>>> i agree with piyush...can't find the countercase...satisfied with the >>>>> algo. >>>>> >>>>> >>>>> On Fri, May 27, 2011 at 6:58 AM, Piyush Sinha < >>>>> [email protected]> wrote: >>>>> >>>>>> how about adding zeroes at the end of integers to make to equal to the >>>>>> integer with maximum number of digits and sort them... >>>>>> >>>>>> ex- >>>>>> 101 10 >>>>>> >>>>>> adding zeroes.. >>>>>> 101 100 >>>>>> >>>>>> sort 100 101 >>>>>> >>>>>> therefore make number as 10110 >>>>>> >>>>>> 100 1 >>>>>> >>>>>> adding zeroes >>>>>> 100 100 >>>>>> >>>>>> therefore number is 1100 >>>>>> >>>>>> I am not sure of the method.....if there is any counter case please do >>>>>> suggest... >>>>>> >>>>>> On 5/27/11, wujin chen <[email protected]> wrote: >>>>>> > @radha, i think your solution is wrong. >>>>>> > for this case: 101,10 >>>>>> > in your solution , the ans is 10101,but the max ans is 10110. >>>>>> > >>>>>> > 2011/5/27 radha krishnan <[email protected]> >>>>>> > >>>>>> >> 10100 is max ans >>>>>> >> okay >>>>>> >> convert the numbers to strings and sort based on the first >>>>>> character >>>>>> >> !!!!!!! >>>>>> >> if equal do that recursively and then if length is less give that >>>>>> >> preference !! >>>>>> >> i think this solution .. >>>>>> >> may be this is wrong !! >>>>>> >> >>>>>> >> On Fri, May 27, 2011 at 7:07 PM, wujin chen < >>>>>> [email protected]>wrote: >>>>>> >> >>>>>> >>> @Piyush, how to deal with this case :100 , 10 >>>>>> >>> >>>>>> >>> >>>>>> >>> 2011/5/27 Piyush Sinha <[email protected]> >>>>>> >>> >>>>>> >>>> we can work out if we sort according to the leftmost integer >>>>>> >>>> >>>>>> >>>> On 5/27/11, [email protected] <[email protected]> >>>>>> wrote: >>>>>> >>>> > are you kidding me. Just simple sort wont work. >>>>>> >>>> > >>>>>> >>>> > On Fri, May 27, 2011 at 9:31 AM, radha krishnan < >>>>>> >>>> > [email protected]> wrote: >>>>>> >>>> > >>>>>> >>>> >> sort :) >>>>>> >>>> >> >>>>>> >>>> >> >>>>>> >>>> >> On Fri, May 27, 2011 at 6:57 PM, ross <[email protected]> >>>>>> wrote: >>>>>> >>>> >> >>>>>> >>>> >>> Hi all, >>>>>> >>>> >>> >>>>>> >>>> >>> Given an array of elements find the largest possible number >>>>>> that can >>>>>> >>>> >>> be formed by using the elements of the array. >>>>>> >>>> >>> >>>>>> >>>> >>> eg: 10 9 >>>>>> >>>> >>> ans: 910 >>>>>> >>>> >>> >>>>>> >>>> >>> 2 3 5 78 >>>>>> >>>> >>> >>>>>> >>>> >>> ans: 78532 >>>>>> >>>> >>> >>>>>> >>>> >>> 100 9 >>>>>> >>>> >>> >>>>>> >>>> >>> ans: 9100 >>>>>> >>>> >>> >>>>>> >>>> >>> -- >>>>>> >>>> >>> 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. >>>>>> >>>> >>> >>>>>> >>>> >>> >>>>>> >>>> >> -- >>>>>> >>>> >> 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. >>>>>> >>>> >> >>>>>> >>>> > >>>>>> >>>> > -- >>>>>> >>>> > 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. >>>>>> >>>> > >>>>>> >>>> > >>>>>> >>>> >>>>>> >>>> >>>>>> >>>> -- >>>>>> >>>> *Piyush Sinha* >>>>>> >>>> *IIIT, Allahabad* >>>>>> >>>> *+91-8792136657* >>>>>> >>>> *+91-7483122727* >>>>>> >>>> *https://www.facebook.com/profile.php?id=100000655377926 * >>>>>> >>>> >>>>>> >>>> -- >>>>>> >>>> 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. >>>>>> >>>> >>>>>> >>>> >>>>>> >>> -- >>>>>> >>> 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. >>>>>> >>> >>>>>> >> >>>>>> >> -- >>>>>> >> 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. >>>>>> >> >>>>>> > >>>>>> > -- >>>>>> > 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. >>>>>> > >>>>>> > >>>>>> >>>>>> >>>>>> -- >>>>>> *Piyush Sinha* >>>>>> *IIIT, Allahabad* >>>>>> *+91-8792136657* >>>>>> *+91-7483122727* >>>>>> *https://www.facebook.com/profile.php?id=100000655377926 * >>>>>> >>>>>> -- >>>>>> 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. >>>>>> >>>>>> >>>>> -- >>>>> 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. >>>>> >>>> >>>> >>>> >>>> -- >>>> Regards, >>>> Vipul >>>> >>>> >>> >>> >>> -- >>> Regards, >>> Vipul >>> >>> -- >>> 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. >>> >> >> >> >> -- >> -Aakash Johari >> (IIIT Allahabad) >> >> >> >> >> -- >> 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. >> > > > > -- > -Arpit Mittal > 6th Semester, > Indian Institute of Information Technology,Allahabad > Email : [email protected] > [email protected] > Contact : +91-8853049787 > > Let every man be respected as an individual and no man idolized. > > > -- > 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. > -- Regards, Vipul -- 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.
