You have an array of 0s and 1s and you want to output all the
intervals (i, j) where the number of 0s and numbers of 1s are equal.

Example

pos = 0 1 2 3 4 5 6 7 8
arr  = 0 1 0 0 1 1 1 1 0

One interval is (0, 1) because there the number of 0 and 1 are equal.
There are many other intervals, find all of them in linear time.

-- 
*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 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.

Reply via email to