Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 2f9ef88

Browse files
authoredMar 12, 2025··
2529_Maximum_Count_of_Positive_Integer_and_Negative_Integer.java
1 parent 5e062f5 commit 2f9ef88

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed
 
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
// Problem Number: 2529
2+
3+
// Maximum Count of Positive Integer and Negative Interger.
4+
5+
class Solution {
6+
public int maximumCount(int[] nums) {
7+
int pos=0;
8+
int neg=0;
9+
10+
for(int i=0; i<nums.length; i++){
11+
if(nums[i]>0){
12+
pos++;
13+
}
14+
else if(nums[i]<0){
15+
neg++;
16+
}
17+
}
18+
return Math.max(pos,neg);
19+
}
20+
}

0 commit comments

Comments
 (0)
Please sign in to comment.