Skip to content

Commit 2ed3303

Browse files
authored
Create 2529-maximum-count-of-positive-integer-and-negative-integer.js
1 parent 21876f4 commit 2ed3303

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
/**
2+
* @param {number[]} nums
3+
* @return {number}
4+
*/
5+
var maximumCount = function(nums) {
6+
let pos = 0, neg = 0
7+
8+
for(const e of nums) {
9+
if(e > 0) pos++
10+
else if(e < 0) neg++
11+
}
12+
13+
return Math.max(pos, neg)
14+
};

0 commit comments

Comments
 (0)