1822. Tanda produk leetcode array
class Solution {
public:
int arraySign(vector<int>& nums) {
long long sum=1;
for(int i=0;i<nums.size();i++)
{
if(nums[i]>0)
nums[i]=1;
else if(nums[i]<0)
nums[i]=-1;
else
nums[i]=0;
sum*=nums[i];
}
return sum;
}
};
coder