Skip to content

Commit 9c32dc8

Browse files
committed
p2529
1 parent 37789a4 commit 9c32dc8

File tree

2 files changed

+24
-2
lines changed

2 files changed

+24
-2
lines changed

Diff for: src/main.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
mod p1358;
1+
mod p2529;
22

33
pub fn main() {
4-
p1358::run();
4+
p2529::run();
55
}

Diff for: src/p2529.rs

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
pub fn run() {
2+
for i in [
3+
4+
] {
5+
println!("{}", maximum_count(i));
6+
}
7+
}
8+
9+
pub fn maximum_count(nums: Vec<i32>) -> i32 {
10+
let mut p = 0;
11+
let mut n = 0;
12+
13+
for i in nums {
14+
if i > 0 {
15+
p += 1;
16+
} else if i < 0 {
17+
n += 1;
18+
}
19+
}
20+
21+
p.max(n)
22+
}

0 commit comments

Comments
 (0)