CPP
1822. Sign of the Product of an Array leetcode in c++
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;
}
};
1822. Sign of the Product of an Array leetcode
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;
}
};
1822. Sign of the Product of an Array leetcode
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;
}
};
1822. Sign of the Product of an Array leetcode in c++
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;
}
};
1822. Sign of the Product of an Array leetcode
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;
}
};
1822. Sign of the Product of an Array leetcode
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;
}
};
1822. Sign of the Product of an Array leetcode
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;
}
};
1822. Sign of the Product of an Array leetcode
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;
}
};
1822. Sign of the Product of an Array leetcode
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;
}
};
1822. Sign of the Product of an Array leetcode
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;
}
};
1822. Sign of the Product of an Array leetcode in c++
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;
}
};
1822. Sign of the Product of an Array leetcode
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;
}
};
1822. Sign of the Product of an Array leetcode in c++
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;
}
};
1822. Sign of the Product of an Array leetcode
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;
}
};
1822. Sign of the Product of an Array leetcode
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;
}
};
1822. Sign of the Product of an Array leetcode in c++
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;
}
};
1822. Sign of the Product of an Array leetcode
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;
}
};
1822. Sign of the Product of an Array leetcode in c++
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;
}
};
1822. Sign of the Product of an Array leetcode
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;
}
};
1822. Sign of the Product of an Array leetcode in c++
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;
}
};
1822. Sign of the Product of an Array leetcode in c++
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;
}
};
1822. Sign of the Product of an Array leetcode
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;
}
};
1822. Sign of the Product of an Array leetcode
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;
}
};
1822. Sign of the Product of an Array leetcode
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;
}
};
1822. Sign of the Product of an Array leetcode
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;
}
};
1822. Sign of the Product of an Array leetcode
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;
}
};