Let's say we have a string of length n and each character has probability p of being 1 and probability 1-p of being 0. What is the expected value of the number of "islands" of 1s in the string (the number of consecutive sequences of 1s bounded by 0s or the ends of the strings on both sides).
For example, 0011001111101101 would have 4 islands.