Maximum product of contiguous subsequence over $\mathbb{R}$
You can adopt the dynamic programming solution; the other solution looks harder to adapt.

Given an array $A_1,\ldots,A_n$, we let $P_i$ be the maximum positive product of a subsequence of $A_1,\ldots,A_i$ containing $A_i$, and we let $N_i$ be the minimum negative product of such a subsequence. If no such subsequences exist, we let $P_i = 0$ or $N_i = 0$.

Initialization:


If $A_1 = 0$ then $P_1 = N_1 = 0$.
If $A_1 &gt; 0$ then $P_1 = A_1$ and $N_1 = 0$.
If $A_1 &lt; 0$ then $P_1 = 0$ and $N_1 = A_1$.


Iteration:


If $A_i = 0$ then $P_i = N_i = 0$.
If $A_i &gt; 0$ then $P_i = \max(A_i, A_i P_{i-1})$ and $N_i = A_i N_{i-1}$.
If $A_i &lt; 0$ then $P_i = A_i N_{i-1}$ and $N_i = \min(A_i, A_i P_{i-1})$.


If $\max(P_1,\ldots,P_n) &gt; 0$, then this is the answer. The only way in which this fails to happen is if there is no subsequence whose product is positive. This can only happen if the array contains only negative numbers and zeroes, and every two negative numbers are separated by at least one zero. If there is at least one zero, then the answer is zero. If there are no zeroes, then $n = 1$, and the answer is $A_1$.