Consider 2 temp arrays, B and C Where B gets updated for every find of 0 and C for every find of 1
i.e if(a[i]==0) b[i]+=b[i-1]+1; c[i]=c[i-1]; i.e if(a[i]==1) c[i]+=c[i-1]+1; b[i]=b[i-1]; if(c[i]==b[i]) update max. return max. This is O(N) algo. Is it right or i am missing anything here? -- 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/-/YnKOgIEspAcJ. To post to this group, send email to algogeeks@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.