here’s a question that was recently asked by amazon. The position was for SDE II, L-5, United States. The question was in two parts. You are given a string and a wordlist. The string is a combination of words from the word list. Your goal is to
- Find the words that were used to create the string
- For each of those words, find the next closest word to it from the wordlist (Minimal edits)
Example: Word list [“tree”, “apple”, “orange”, “big”, “bigger”, “biggest”, “fast”, “faster”, “fastest”, “cat”, “cart”]
- String = “fasterbiggercat”
- Words used to form string = faster, bigger, cat
- Closest edits to each word = fastest (2 edits), biggest (2 edits), cart (1 edit)
- Return fastestbiggestcart