8000
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent fbb25bb commit c6c1271Copy full SHA for c6c1271
src/bin/maximum-population-year.rs
@@ -0,0 +1,27 @@
1
+fn main() {}
2
+
3
+struct Solution;
4
5
+impl Solution {
6
+ pub fn maximum_population(logs: Vec<Vec<i32>>) -> i32 {
7
+ let mut v = vec![0; 1000];
8
9
+ for i in logs {
10
+ for x in (i[0] - 1950) as usize..(i[1] - 1950) as usize {
11
+ v[x] += 1;
12
+ }
13
14
15
+ let mut max = 0;
16
17
+ for i in 1..v.len() {
18
+ max = if v[i] > v[max] {
19
+ i
20
+ } else {
21
+ max
22
23
24
25
+ max as i32 + 1950
26
27
+}
0 commit comments