1822. Sign of the Product of an Array
class Solution:
def arraySign(self, nums: List[int]) -> int:
sign = 1
for num in nums:
if num == 0:
return num
if num < 0:
sign *= -1
return sign
O(N)
O(1)