fn max_profit(prices: Vec<i32>) -> i32 { // TODO: find the maximum profit from a single buy/sell 0 } fn main() { println!("{}", max_profit(vec![7, 1, 5, 3, 6, 4])); // 5 println!("{}", max_profit(vec![7, 6, 4, 3, 1])); // 0 }
Click Run to execute, or Submit to grade (all languages).