Should the sequence beContinuos ??? On Fri, Jul 8, 2011 at 1:18 AM, sunny agrawal <[email protected]>wrote:
> @rajiv > if Count = 2 means 3 elements isn't it a,a+d,a+2d > else according to you > for case 10 12 14 24 26 28 > diff 2 2 10 2 2 > diff 2 has count 4 so will you say ap of 4 elements with diff 2 > > On Fri, Jul 8, 2011 at 1:06 AM, rajeev bharshetty <[email protected]>wrote: > >> @sunny Keep count of longest repeated element in diff i.e 2 so count =2 so >> ap of 2 elem with diff 2 . >> >> On Fri, Jul 8, 2011 at 1:03 AM, sunny agrawal <[email protected]>wrote: >> >>> @rajiv >>> Fails i think >>> think for 10 12 24 26 >>> diff is 2 12 2 >>> so do you want to say there is an AP pf 3 elements with d = 2, i can't >>> see any :P >>> your solution fails because there can be many APs in the array with the >>> same value of d and you will finish up by combining all those APs >>> >>> >>> On Fri, Jul 8, 2011 at 12:55 AM, rajeev bharshetty <[email protected] >>> > wrote: >>> >>>> >>>> Check the differences between the adjacent elements and store the >>>> differenecs in diff[i] array >>>> then scan through the array . >>>> then keep a count for all the repeated diff elements ,the sequence of >>>> indexes with max count is the solution . >>>> >>>> >>>> >>>> >>>> On Thu, Jul 7, 2011 at 11:43 PM, Piyush Sinha <[email protected] >>>> > wrote: >>>> >>>>> Given an array of integers A, give an algorithm to find the longest >>>>> Arithmetic progression in it, i.e find a sequence i1 < i2 < … < ik, >>>>> such that >>>>> >>>>> A[i1], A[i2], …, A[ik] forms an arithmetic progression, and k is the >>>>> largest possible. >>>>> >>>>> The sequence S1, S2, …, Sk is called an arithmetic progression if >>>>> >>>>> Sj+1 – Sj is a constant. >>>>> >>>>> -- >>>>> *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. >>>> >>> >>> >>> >>> -- >>> Sunny Aggrawal >>> B-Tech IV year,CSI >>> Indian Institute Of Technology,Roorkee >>> >>> -- >>> 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. >> > > > > -- > Sunny Aggrawal > B-Tech IV year,CSI > Indian Institute Of Technology,Roorkee > > -- > 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.
