Yelp interview question

List the strings that are anagrams from a set of strings?

Interview Answers

Anonymous

11 Mar 2017

Sorting the strings is not optimal because each sort is O(N log N) where N is the number of characters in each word. A more optimal solution is to create a function to encode each word as a hash table of character frequencies, which is O(N) for each word.

1

Anonymous

6 Jun 2016

sort the strings and compare

1