How to get the sum of the numbers in the array which are below -1 in sets.
For example
a=[1 -2 0 .5 -3 -4 5 7 -2 -3 -4];
so here the numbers which are consecutively less than -1 should be added only.
i.e. The answer should be
b=[-2 -7 -10]
PS: Actual data is very big.
Best Answer