You are given an integer array nums.
Your task is to determine the sign of the product of all elements in the array.
Note that:
-1.0.1.Return -1, 0, or 1 representing the sign of the product.
[-1, -2, -3, -4, 3, 2, 1]
1
The product of all values in the array is 144, which is positive, so we return 1.
[1, 5, 0, 2, -3]
0
The array contains 0, so the product is 0, and we return 0.
[-1, 1, -1, 1, -1]
-1
The product of all values in the array is -1, which is negative, so we return -1.
[-1, -2, -3, -4, 3, 2, 1]
1