Leetcode 1258. Synonymous Sentences
Given pairs of synonymous words and a sentence, generate all distinct sentences formed by replacing any word with any of its synonyms (synonym relations are transitive). The core challenge is to group connected synonyms (union-find/graph) and use backtracking/Cartesian-product enumeration to produce and sort all valid sentence combinations.
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.