This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Assume we have a list of words from the English dictionary | |
* [“water”, “big”, “apple”, “banana”, “york”, “amsterdam”, “orange”, “machintosh”, “bottle”, “book”] | |
* And another long list go string to process. | |
* Write a function that will identify “compound words” and return them | |
* Input: [“paris”, “applewatch”, “ipod”, “bigbook”, “orange”, “waterbottle”] | |
* Output: [“applewatch”, “bigbook”, “waterbottle”] | |
*/ | |
const dictionary = ["water", "big", "apple", "banana", "york", "amsterdam", "orange", "machintosh", "bottle", "book"]; |