Skip to content

Commit b6cae20

Browse files
refactor 648
1 parent 1aaaf92 commit b6cae20

File tree

1 file changed

+0
-26
lines changed
  • src/main/java/com/fishercoder/solutions

1 file changed

+0
-26
lines changed

src/main/java/com/fishercoder/solutions/_648.java

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -2,32 +2,6 @@
22

33
import java.util.List;
44

5-
/**
6-
* 648. Replace Words
7-
8-
* In English, we have a concept called root,
9-
* which can be followed by some other words to form another longer word
10-
* - let's call this word successor.
11-
* For example, the root an, followed by other, which can form another word another.
12-
* Now, given a dictionary consisting of many roots and a sentence.
13-
* You need to replace all the successor in the sentence with the root forming it.
14-
* If a successor has many roots can form it, replace it with the root with the shortest length.
15-
16-
You need to output the sentence after the replacement.
17-
18-
Example 1:
19-
Input: dict = ["cat", "bat", "rat"]
20-
sentence = "the cattle was rattled by the battery"
21-
Output: "the cat was rat by the bat"
22-
23-
Note:
24-
The input will only have lower-case letters.
25-
1 <= dict words number <= 1000
26-
1 <= sentence words number <= 1000
27-
1 <= root length <= 100
28-
1 <= sentence words length <= 1000
29-
30-
*/
315
public class _648 {
326
public static class Solution1 {
337
public String replaceWords(List<String> dict, String sentence) {

0 commit comments

Comments
 (0)