1822. Sign of the Product of an Array
On This Page
class Solution:
def arraySign(self, nums: List[int]) -> int:
res = 1
for v in nums:
if v == 0:
return 0
if v < 0:
res *= -1
return res