|
9 | 9 | importjava.util.Map; |
10 | 10 | importjava.util.Set; |
11 | 11 |
|
12 | | -/** |
13 | | - * 1258. Synonymous Sentences |
14 | | - * |
15 | | - * Given a list of pairs of equivalent words synonyms and a sentence text, Return all possible synonymous sentences sorted lexicographically. |
16 | | - * |
17 | | - * Example 1: |
18 | | - * Input: |
19 | | - * synonyms = [["happy","joy"],["sad","sorrow"],["joy","cheerful"]], |
20 | | - * text = "I am happy today but was sad yesterday" |
21 | | - * Output: |
22 | | - * ["I am cheerful today but was sad yesterday", |
23 | | - * "I am cheerful today but was sorrow yesterday", |
24 | | - * "I am happy today but was sad yesterday", |
25 | | - * "I am happy today but was sorrow yesterday", |
26 | | - * "I am joy today but was sad yesterday", |
27 | | - * "I am joy today but was sorrow yesterday"] |
28 | | - * |
29 | | - * Constraints: |
30 | | - * 0 <= synonyms.length <= 10 |
31 | | - * synonyms[i].length == 2 |
32 | | - * synonyms[0] != synonyms[1] |
33 | | - * All words consist of at most 10 English letters only. |
34 | | - * text is a single space separated sentence of at most 10 words. |
35 | | - * */ |
36 | 12 | publicclass_1258 { |
37 | 13 | publicstaticclassSolution1 { |
38 | 14 | publicList<String>generateSentences(List<List<String>>synonyms,Stringtext) { |
|