A consecutive series in the array? Is this really what you are looking for?
input: N, a[0..n-1] l=r=c=0 while r < n && c < N do while c < N && r < n do c = c + a[r] r = r + 1 od while c > N do c = c - a[l] l = l + 1 od od if c == N then return "yes" return "no" Regards, Daniel shishir wrote: > Given an array of integers and a number N, find if there exists a > consecutive series of numbers in this array which sum up to N. > > Regards, > Shishir > > > > --~--~---------~--~----~------------~-------~--~----~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/algogeeks -~----------~----~----~----~------~----~------~--~---