Find concatenated words in list | Amazon Interview Question