Final Prices With a Special Discount in a Shop LeetCode solution in Rust
1impl Solution {2pub fn final_prices(prices: Vec<i32>) -> Vec<i32> {3let mut res = Vec::with_capacity(prices.len());4'main: for (i, &ai) in prices.iter().enumerate() {5for &aj in prices.iter().skip(i + 1) {6if aj <= ai {7res.push(ai - aj);8continue 'main;9}10}11res.push(ai);12}13res14}15}