Solution Blog: (sign into leetcode to view)
https://leetcode.com/problems/sign-of...
There's just 3 cases!
Once you encounter a zero, just return zero right away. No matter what you multiply with zero it'll stay zero.
When you encounter a positive number, do nothing, the sign of the running product will remain the same.
When you encounter a negative number invert the sign!
Time complexity: O(N)
Space complexity: O(1)