Pergunta de entrevista da empresa Microsoft

Write code in your favorite programming language that will accept two strings and return true if they are anagrams.

Respostas da entrevista

Sigiloso

31 de out. de 2010

Found this good link. Time complexity is O(n). http://www.dreamincode.net/code/snippet1481.htm The algorithm can still be improved but gives some basic idea on how to implement.

1

Sigiloso

22 de out. de 2010

This was not really that hard to write it, however the interviewer asked me to reduce the complexity. My initial version had n*log(n) complexity and he asked me to reduce it to no more than n complexity. If you have had some upper level Computer Science classes this is not too difficult, however what they are looking for is a way to stump you. If you adjust your code or thinking rapidly to their request they will change it again until they find something that you have trouble with. Do not be discouraged by this, it is the interviewers job to determine how much you know!