Sollicitatievraag bij Yelp

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

Antwoorden op sollicitatievragen

Anoniem

11 mrt 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

Anoniem

6 jun 2016

sort the strings and compare

1