2019-11-10 LeetCode in Rust LeetCode 1078. Occurrences After Bigram Problem Statement impl Solution { pub fn find_ocurrences(text: String, first: String, second: String) -> Vec<String> { let ss = text.split_whitespace().collect::<Vec<&str>>(); let mut ans = vec![]; let (size, mut i, mut j) = (ss.len(), 0, 1); while i < size && j < size { if *ss[i] == first && *ss[j] == second && j + 1 < size { ans.push(ss[j + 1].to_string()); i = j + 1; j = i + 1; continue; } else { i += 1; j += 1; } } return ans; }} Newer LeetCode 1059. All Paths from Source Lead to Destination Older LeetCode 1079. Letter Tile Possibilities