Pergunta de entrevista da empresa J.P. Morgan

Is this word an anagram

Resposta da entrevista

Sigiloso

16 de out. de 2024

A good approach would be to sort the characters of the words and then compare. (Be sure to have an edge case where if the lengths do not match or if any or both of the Strings are empty/null then exit). Better approach would be to have an ASCII charset where characters of the 1st String ++ the charset array and characters of the second string - - the array. Finally iterate through the array and return false if any of the elements is not 0.