23.05.02 Today’s Leetcode
1822. Sign of the Product of an Array (easy)
class Solution:
def arraySign(self, nums: List[int]) -> int:
res = 1
for num in nums:
if num < 0: res *= -1
if num == 0:
return 0
return res