#1822

Sign of the Product of an Array

pupil · 340 · lc easy +22 · verified · 64.8% accepted · 2,290 likes · top 68%

Description

Define signFunc(x) as 1 if x > 0, -1 if x < 0, or 0 if x == 0. Given an integer array nums, return signFunc applied to the product of all elements.

Code

1
2
3