Morgan Stanley interview question

The coding question was finding word anagrams.