class Solution:
def arraySign(self, nums: list[int]) -> int:
sig = True
for num in nums:
if num == 0:
return 0
if num < 0:
sig = not sig
return int(sig or -1)
1822. Sign of the Product of an Array - LeetCode
ยท One min read