Amazon Interview Question

Question with list of strings.