summaryrefslogtreecommitdiff
path: root/find-the-highest-altitude/src/main.rs
blob: 82fac4d7dd5d0104a5f29b815a1f745d5b64cd46 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
fn main() {
    println!("Hello, world!");
}

struct Solution;

impl Solution {
    pub fn largest_altitude(gain: Vec<i32>) -> i32 {
        let mut altitude = 0;
        let mut result = 0;
        for x in gain {
            altitude += x;
            result = result.max(altitude);
        }
        result
    }
}