Skip to content

Commit 85e4047

Browse files
committed
Create 2148-count-elements-with-strictly-smaller-and-greater-elements.rs
1 parent c54d828 commit 85e4047

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
pub fn count_elements(nums: Vec<i32>) -> i32 {
2+
let min = *nums.iter().min().unwrap();
3+
let max = *nums.iter().max().unwrap();
4+
let mut ret = 0;
5+
for num in nums {
6+
if num == min { continue }
7+
if num == max { continue }
8+
ret += 1;
9+
}
10+
ret
11+
}
12+
13+
fn main() {
14+
let nums = vec![-65,-65,50,-65,50,-55,-65,-65];
15+
println!("{:?}", count_elements(nums));
16+
}

0 commit comments

Comments
 (0)