Pergunta de entrevista da empresa Petuum

Check whether two words are anagram with each other.

Resposta da entrevista

Sigiloso

15 de fev. de 2019

sort strings - Check length - Compare strings - nlogn solution Efficient solution Keep a counter of each character for string 1 and a counter of each character string 2 If string lengths are different - false and if count 1 and count 2 of the character is same - they are anagrams. - Computation O(n) time.