Solution 1 - Track Sign
Return 0 if any element is 0; otherwise flip sign for each negative.
""" 1822.1 - Sign of the Product of an Array - Solution 1 - Track Sign """
from typing import List
class Solution:
def arraySign(self, nums: List[int]) -> int:
sign = 1
for x in nums:
if x == 0:
return 0
if x < 0:
sign *= -1
return sign