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 } }