Leetcode 1181. Before and After Puzzle
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.
Question Timeline
See when this question was last asked and where, including any notes left by other candidates.
0
Hello Interview Premium
Your account is free and you can post anonymously if you choose.