Rust | 0ms | Short Solution
Code\nrust []\nimpl Solution {\n    pub fn last_visited_integers(nums: Vec<i32>) -> Vec<i32> {\n        let (mut seen, mut k) = (std::collections::VecDeque::wit
# Code\n```rust []\nimpl Solution {\n    pub fn last_visited_integers(nums: Vec<i32>) -> Vec<i32> {\n        let (mut seen, mut k) = (std::collections::VecDeque::with_capacity(100), 0);\n        nums.into_iter().fold(Vec::with_capacity(100), |mut acc, num| {\n            if num.is_positive() {\n                seen.push_front(num);\n                k = 0;\n            } else {\n                acc.push(seen.get(k).map_or(-1, |v| *v));\n                k += 1;\n            }\n            acc\n        })\n    }\n}\n```
['Rust']