“1822. Tanda produk leetcode array” Kode Jawaban

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

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

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

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

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

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

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

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

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

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

Jawaban yang mirip dengan “1822. Tanda produk leetcode array”

Pertanyaan yang mirip dengan “1822. Tanda produk leetcode array”

Jelajahi jawaban kode populer menurut bahasa

Jelajahi bahasa kode lainnya