will an o(n^2) do ? , i have one in mind but will that suffice ? anyways , here it goes make array a[array_length][2]; a[k][0] and a[k][1] will contain the no. of 0's and 1 till kth position. just iterate twice to see where a[i][0]-a[j][0]==a[i][1]-a[j][1] can be maximized . meanwhile i am thinking of other solution . . . .
On Tue, Jan 4, 2011 at 2:08 PM, bittu <shashank7andr...@gmail.com> wrote: > You have a array of 0's and 1's. e.g. > 0001011101001010100101010101100111 > Find the maximum contiguous subsequence of the above sequence so the > number of 0's and 1's in that subsequence are equal > > > Regards > Shashank Mani > > -- > You received this message because you are subscribed to the Google Groups > "Algorithm Geeks" group. > To post to this group, send email to algoge...@googlegroups.com. > To unsubscribe from this group, send email to > algogeeks+unsubscr...@googlegroups.com<algogeeks%2bunsubscr...@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 algoge...@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.