Microsoft Interview Question: Write code in your favorite p... | Glassdoor

Interview Question

Software Development Engineer In Test (SDET) Interview(Student Candidate) Redmond, WA

Write code in your favorite programming language that will

  accept two strings and return true if they are anagrams.
Answer

Interview Answer

2 Answers

0

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!

Interview Candidate on Oct 21, 2010
1

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.

Powar on Oct 31, 2010

Add Answers or Comments

To comment on this, Sign In or Sign Up.