Given a circular list of two numbers $-1,+1$.I have to partition them into $M$ sets each containing $K$ numbers. Each set has to consist of consecutive $K$ numbers from that list. The set can start from any point in the list.
1.A set is called positive if number of $+1$ are greater than $-1$.
2.A set is called negative if number of $-1$ are greater than $+1$.
Now I want to know if there's a way to partition them such that the number of positive sets are more than number of negative sets.
Take $K$ to be odd for simplicity so that a set can be either called positive or negative.
For eg- List $A$ = $(-1, -1, 1, 1, -1, 1, 1, -1, -1)$ and I have to partition it into $3$ sets with $3$ numbers in it. Then there are many ways : 1. {$A_3$,$A_4$,$A_5$}, {$A_6$,$A_7$,$A_8$} and {$A_9$,$A_1$,$A_2$}
- {$A_2$,$A_3$,$A_4$}, {$A_5$,$A_6$,$A_7$} and {$A_8$,$A_9$,$A_1$}
Here $2$ positive sets and $1$ negative set. So I can partition it.
I can only think of making every possible combination. Is there a way to do it efficiently and optimally.