sorry, concatenate the found no in the new no rather than putting it in the new no...
On 8/15/11, Puneet Gautam <[email protected]> wrote: > I think this may work..!! > > Sort the input array first, extract each no.s first digit and put them > in another array.. > Then compare each element of new array with fist digit of main > array.. and then concatenate the found ones to a string... > > eg:if input a[]=34,567,87,98,33,1, new array b[]={3,5,8,9,3,1} > > after sorting both arrays.. > we get a[]={567,87,98,34,23,1} and b[]={9,8,5,3,3,1} > > Take each element in b and compare ith first digit of array a , then > put that no. in a new no... > hence largest no=new no proceeds as: > > 98 > 9887 > 9887567 > 988756734 > 98875673433 > 988756734331 > hence the result is found.. > > the algo takes O(n^2) time .. > > what say guys..? > > > > > > > > On 8/15/11, Ankur Khurana <[email protected]> wrote: >> Just a qestion, how do you sort lexographically ? that is tha approach >> that >> we will apply here.. .and yes the approach is flawed. will come with a >> solution soon.. >> >> On Mon, Aug 15, 2011 at 8:42 AM, Dipankar Patro <[email protected]> >> wrote: >> >>> @ Kunal: >>> oh. zero is making some nice test cases. I will have to reconsider the >>> solution that I provided. >>> >>> >>> On 15 August 2011 01:53, Yasir <[email protected]> wrote: >>> >>>> Not Sure! Me too looking for a solution.. :D >>>> >>>> So far, Kunal's approach (Convert each string to length max_size where >>>> you append it circularly) seems to be working fine. :-) >>>> >>>> ..and Chengjie's approach should also work, but the interviewer >>>> rejected >>>> this idea saying, he wants a good logic for this. :) >>>> >>>> -- >>>> 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/-/sRTcLi6r_IYJ. >>>> >>>> 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. >>>> >>> >>> >>> >>> -- >>> >>> ___________________________________________________________________________________________________________ >>> >>> Please do not print this e-mail until urgent requirement. Go Green!! >>> Save Papers <=> Save Trees >>> >>> -- >>> 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. >>> >> >> >> >> -- >> Ankur Khurana >> Computer Science >> Netaji Subhas Institute Of Technology >> Delhi. >> >> -- >> 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.
