Group strings that are anagrams | J.P. Morgan Coding Question