> For the complete documentation index, see [llms.txt](https://emmaguo100.gitbook.io/leetcode/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://emmaguo100.gitbook.io/leetcode/02-24-2022-1567.md).

# 02/24/2022 1567

At every iteration, tracking maximum length of positive multiplicative result and negative multiplicative result can help.\
Multiplicative Result : result(+ve/-ve) of multiplication of bunch of numbers(some of which can be +ve/-ve)

1. If we see a 0, we gotta start off things again
2. If we see a positive number :\
   2.1. Increase length of positive mutilpicative result till now.\
   2.2. Increase length of negative mutilpicative result till now, unless we had not encountered any negative before.
3. If we see a negative number:\
   3.1. It's time to swap positive and negative multiplicative results' lengths and do similar task as we did in above case.
4. In each iteration, use the length of positive mutilpicative result to compute answer.

Time O(n)

Space O(1)
