# the number of 1’s in it is at least as much as the number of 0’s

You are given a list of $$0$$’s and $$1$$’s: $$B[1]$$, $$B[2]$$, . . . , $$B[N]$$. A sublist of this list is any contiguous segment of elements—i.e., $$A[i]$$, $$A[i + 1]$$, . . . , $$A[j]$$, for some $$i$$ and $$j$$. A sublist is said to be Heavy, if the number of $$1$$’s in it is at least as much as the number of $$0$$’s in it.

We want to partition the entire list into Heavy sublists. That is, a valid partition is a collection of Heavy sublists, such that each of the N elements is part of exactly one of the sublists. We want to find the number of ways of doing so.

For example, suppose $$N$$ was $$3$$ and $$B = [1, 0, 1]$$. Then all the sublists in this are Heavy, except for the sublist which contains only the second element $$([0])$$. The various valid partitions are as follows: $$( [1, 0, 1] )$$$$( [1, 0], [1] )$$
$$( [1], [0, 1] )$$

Since there are $$3$$ ways to do this, the answer for this would be $$3$$.
Compute the number of ways of partitioning the given list into Heavy sublists for the following instances.

(a) $$N = 8, B = [0, 1, 1, 0, 0, 1, 1, 1]—i.e., B[1] = 0, B[1] = 1, . . . , B[8] = 1$$
(b) $$N = 9, B = 1, 1, 0, 0, 1, 0, 0, 1, 1—i.e., B[1] = 1, B[1] = 1, . . . , B[9] = 1$$
(c) $$N = 9, B = 1, 0, 1, 0, 1, 1, 0, 1, 1—i.e., B[1] = 1, B[1] = 0, . . . , B[9] = 1$$

This is the first question that I am asking on Math.SE. I am sorry if I am being too direct in asking the question. source:- Q.$$3$$ ZIO-$$2018$$

How can i solve it by mathematical approach?

• You should show your own effort, not just copy the given sample test cases. – user21820 Jan 16 at 15:53