1078. Occurrences After Bigram Easy
1/**
2 * [1078] Occurrences After Bigram
3 *
4 * Given two strings first and second, consider occurrences in some text of the form "first second third", where second comes immediately after first, and third comes immediately after second.
5 * Return an array of all the words third for each occurrence of "first second third".
6 *
7 * Example 1:
8 * Input: text = "alice is a good girl she is a good student", first = "a", second = "good"
9 * Output: ["girl","student"]
10 * Example 2:
11 * Input: text = "we will we will rock you", first = "we", second = "will"
12 * Output: ["we","rock"]
13 *
14 * Constraints:
15 *
16 * 1 <= text.length <= 1000
17 * text consists of lowercase English letters and spaces.
18 * All the words in text a separated by a single space.
19 * 1 <= first.length, second.length <= 10
20 * first and second consist of lowercase English letters.
21 *
22 */
23pub struct Solution {}
24
25// problem: https://leetcode.com/problems/occurrences-after-bigram/
26// discuss: https://leetcode.com/problems/occurrences-after-bigram/discuss/?currentPage=1&orderBy=most_votes&query=
27
28// submission codes start here
29
30impl Solution {
31 pub fn find_ocurrences(text: String, first: String, second: String) -> Vec<String> {
32 vec![]
33 }
34}
35
36// submission codes end
37
38#[cfg(test)]
39mod tests {
40 use super::*;
41
42 #[test]
43 fn test_1078() {
44 }
45}
46
Back
© 2025 bowen.ge All Rights Reserved.