Skip to content

Commit

Permalink
Time: 12 ms (16.81%), Space: 10.2 MB (45.94%) - LeetHub
Browse files Browse the repository at this point in the history
  • Loading branch information
Dipendra-Raghav committed May 2, 2023
1 parent e076b26 commit 7f8453a
Showing 1 changed file with 15 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
class Solution {
public:

int arraySign(vector<int>& nums) {

int cnt=0;
for(int i=0;i<nums.size();i++)
{
if(nums[i]<0)cnt++;
if(nums[i]==0)return 0;
}
return cnt%2==0? 1 : -1;

}
};

0 comments on commit 7f8453a

Please sign in to comment.