GoLang Solution For LeetCode Problem: Replace Words
Solving Replace Words in go. Please try yourself first to solve the problem and submit your implementation to LeetCode before looking into solution.
You need to output the sentence after the replacement.
Input: dict = ["cat", "bat", "rat"] sentence = "the cattle was rattled by the battery" Output: "the cat was rat by the bat"
- The input will only have lower-case letters.
- 1 <= dict words number <= 1000
- 1 <= sentence words number <= 1000
- 1 <= root length <= 100
- 1 <= sentence words length <= 1000
See the full details of the problem Replace Words at LeetCode
Originally posted at: @github.com/halfrost/LeetCode-Go