Available question text
Given a list of phrases, produce all unique "before-and-after" phrases formed by concatenating phrase A and phrase B whenever the last word of A equals the first word of B (omitting the duplicated middle word), and return them (typically sorted). The core challenge is efficient string parsing and deduplication, e.g., by grouping phrases by their first/last words and combining matching pairs.
Related questions
Continue with questions that share topics or the same question type.
Sources · 1 reference
These records explain where the question appears. A company tag or candidate report does not guarantee a future interview question.
Hello Interview · 1 record
No company association
Leetcode 1181. Before and After Puzzle
Reported date not specified · 0 source reports
Source snapshot: Nov 12, 2026
View source