Tap here to switch tabs
Problem
Submissions

Problem: Occurrences After Bigram

med
30 min
Try to solve the Occurrences After Bigram problem.

Statement

Given three strings text, first, and second, find every word that immediately follows an occurrence of first followed immediately by second.

Return an array containing all such words in the order of their appearance in text.

Constraints:

  • 1≤1 \leq text.length ≤1000\leq 1000

  • text consists of lowercase English letters and spaces.

  • All the words in text are separated by a single space.

  • 1≤1 \leq first.length, second.length ≤10\leq 10

  • first and second consist of lowercase English letters.

  • text will not have any leading or trailing spaces.

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Occurrences After Bigram

med
30 min
Try to solve the Occurrences After Bigram problem.

Statement

Given three strings text, first, and second, find every word that immediately follows an occurrence of first followed immediately by second.

Return an array containing all such words in the order of their appearance in text.

Constraints:

  • 1≤1 \leq text.length ≤1000\leq 1000

  • text consists of lowercase English letters and spaces.

  • All the words in text are separated by a single space.

  • 1≤1 \leq first.length, second.length ≤10\leq 10

  • first and second consist of lowercase English letters.

  • text will not have any leading or trailing spaces.