2019-11-10 LeetCode in Rust LeetCode 871. Minimum Number of Refueling Stops Problem Statement use std::collections::BinaryHeap;impl Solution { pub fn min_refuel_stops(target: i32, start_fuel: i32, stations: Vec<Vec<i32>>) -> i32 { let (mut cur, mut stops, mut i) = (start_fuel, 0, 0); let mut q = BinaryHeap::new(); loop { if cur >= target { return stops; } while i < stations.len() && stations[i][0] <= cur { q.push(stations[i][1]); i += 1; } if q.is_empty() { break; } cur += q.pop().unwrap(); stops += 1; } return -1; }} Newer LeetCode 865. Smallest Subtree with all the Deepest Nodes Older LeetCode 872. Leaf-Similar Trees