Group a list to club maximum negatives together Given a list made of integers  either positive or negative: I want to make $N$ groups with consecutive $M$ integers in it such that in every group, majority are  positive. Is there a way to group them so if possible.
Eg- $N=2,M=3$ and list is $(-2 ,-2,2,2,-2,-2 )$ then 1 of the possible combination of groups can be $(-2(2),2(3),2(4)), (-2(5),-2(6),-2(1))$. The inner parenthesis represents its position in list.
I can only think of trying every combination i.e. brute force. 
EDIT : To simplify: No $0$ and $M$ is odd and only majority of positive is needed.
 A: You could make a parallel list of the running total of $M$ sign values, each starting at element $i$ and running to element $i+M-1$ with wraparound:
List: $(-2 ,-2,2,2,-2,-2 )$
Signs only: $(
\color{red}{-1}, 
\color{orange}{-1},
\color{brown}{1},
\color{green}{1},
\color{blue}{-1},
\color{purple}{-1} )$
Length-$3$ totals:
$(
\color{red}{-1}+ 
\color{orange}{-1}+
\color{brown}{1}=-1,$
$\color{orange}{-1}+
\color{brown}{1}+
\color{green}{1}=1,$
$\color{brown}{1}+
\color{green}{1}+
\color{blue}{-1}=1,$
$\color{green}{1}+
\color{blue}{-1}+
\color{purple}{-1}=-1,$
$\color{blue}{-1}+
\color{purple}{-1}+
\color{red}{-1}=-3,$
$\color{purple}{-1}+
\color{red}{-1}+
\color{orange}{-1}=-3)$
As you can see the sum for the last few elements wraps around and the sum is completed by adding on elements from the start.
Then anything that isn't zero (which, incidentally, with $M$ odd and no zeroes is inevitably everything) indicates a valid starting position for a list.
So a more interesting case would be with an even $M=4$ and here $N=3$:
List:: $1, 4, 4, 2, 1, -4, 2, 3, -4, 0, -3, -1$
Signs: $1, 1, 1, 1, 1, -1, 1, 1, -1, 0, -1, -1$
$M$-length Totals: $4, 4, 2, 2, 2, 0, 1, -1, -3, -1, 0, 2$  
So we would avoid the cases where we include a zero; so we could start with the first element or the fourth element but not with the second or third, because that would include a zero in a later $M$-length list.

So let's try to get the most positive-majority groups possible, for $M$ odd and with no zeroes in the source list.
Once again we can focus onto just sign-value and then make the $M$-length sum lists ($M=3$ this time):
List:: $1, 4, 4, 2, 1, -4, 2, 3, -4, -2, -3, -1$
Signs: $1, \color{red}{1, 1, 1}, 1, -1, 1, \color{blue}{1, -1, -1}, -1, -1$
$M$-length Totals: $3,\color{red}{3},3,1,1,1,1,\color{blue}{-1},-3,-3, -1,1$  
Higlighted here a couple of sets of summing elements to build the $M$-length list.
Then we can abstract these $M$-length-totals down to sign and fold the list down into just one list of M elements representing different splitting positions by summing every $M^{th}$ element:
$M$-length signs: $\color{red}{1},\color{green}{1},\color{blue}{1},\color{red}{1},\color{green}{1},\color{blue}{1},\color{red}{1},\color{green}{-1},\color{blue}{-1},\color{red}{-1}, \color{green}{-1},\color{blue}{1}$
Folded list: $\color{red}{2},\color{green}{0},\color{blue}{2}$
So splitting the list before the first or third element will give us more positive-majority lists than splitting before the second element.
