@memoryless I believe that result in [1, -5, 23, 0, 1, 1, 0, -2,- 5, 3, -1, 1, 2, 3] is 9.

Possible result is : 1, -5, 23, 0, 1, 0, 3, -1, 1

Also for 1, -5, 23, 0, 1, 1, 0, 2, -5, 3, -1, 1, 2, 3 Result is 11

Result : 1,-5,23,0,1,0,2,-5,3,-1,1

Ofocurse if we take 0 for negative or positive depending on the subsequence

Here is my code. zigzag dp modification O(n^2)

```
void maxAlternatingSubseq(int[] nums) {
int[] f1 = new int[nums.length];
int[] f2 = new int[nums.length];
if (nums[0] >=0)
f1[0] = 1;
if (nums[0] <=0)
f2[0] = 1;
for (int i = 1; i < nums.length; i++) {
for (int j = 0; j < i; j++) {
if (nums[i] <= 0 && f1[j] > f2[i] ) {
f2[i] = f1[j];
}
if (nums[i] >= 0 && f2[j] > f1[i] ) {
f1[i] = f2[j];
}
}
f2[i]++;
f1[i]++;
}
int max =0;
for (int i = 0; i < nums.length; i++) {
if (f2[i] > max) {
max = f2[i];
}
if (f1[i] > max) {
max = f1[i];
}
}
System.out.println(max);
}
```