Skip to content

Commit 37789a4

Browse files
committed
p2529 (C)
1 parent cfe1339 commit 37789a4

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

Diff for: c/p2529.c

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
int maximumCount(int* nums, int numsSize) {
2+
int negatives = 0;
3+
int positives = 0;
4+
5+
for (int i = 0; i < numsSize; i++) {
6+
if (nums[i] > 0) {
7+
positives += 1;
8+
} else {
9+
if (nums[i] < 0) {
10+
negatives += 1;
11+
}
12+
}
13+
}
14+
15+
if (negatives > positives) {
16+
return negatives;
17+
}
18+
return positives;
19+
}

0 commit comments

Comments
 (0)