Pregunta de entrevista

Entrevista de Search and Data Mining Engineer

-

Yelp

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

Respuesta

Respuestas de entrevistas

2 respuestas

1

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.

Anónimo en

1

sort the strings and compare

Anónimo en

Añadir respuestas o comentarios

Para publicar un comentario sobre esto, inicia sesión o regístrate.