Microsoft Interview Question for Software Engineer in Tests






Comment hidden because of low score. Click to expand.
1
of 1 vote

Need to Construct a Trie Searching, (Compressed Trie)

- Anonymous March 09, 2011 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

A hash table.
insert the first array and find if an element of the second array exists in the constructed hash table.
if it exists, store the index. finally we have indices of the strings in the second array which are common to both arrays

- ObviousCandidate February 22, 2011 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Method 1:
1. Make a concatenated string of S2 using some delimiter. Say dot (.)
e.g. ConcatS2 = ".Kelos.Dragi.Matt.Ven.Pssi."
2. Pick a word from S1 add delimiter at end and start. Use KMP to serach this pattern in ConcatS2.
e.g. Pick first word "Albert", make pattern as ".Albert." and search in ConcatS2.
**Asumption delimiter is not used in any of original S1 and S2 as a character.
Time Complexity: If S1 contains m number of words and total length of S2 is N then it is m*O(N). Average case will be less than this (Words are Unique)
Method2:
1. Make a trie of S2. Look for each word of S1 if it exist in trie.
Time Complexity: O(length of S1).

- Tulley February 22, 2011 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

Whats wrong with using a hashtable?

- ObviousCandidate February 22, 2011 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 votes

Always good to have a backup solution not using hash table in case the interview gives you a hard time and ask you not to use hash table ;)

- Anonymous February 22, 2011 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 votes

the first method is not O(n)

- Anonymous March 03, 2011 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

An unordered_map should do the trick!

O(m+n) time and O(m) space... where m and n are lenghts of the sets...

- Add all elements from set1 to u_map_1...
- For every element in set 2, check if it is present in u_map_1...
- If it is present, print it out to the console.

PS: Looking for a value in an unordered_map takes O(1) since the keys are hashed.

- Rahul Arakeri September 13, 2012 | Flag Reply


Add a Comment
Name:

Writing Code? Surround your code with {{{ and }}} to preserve whitespace.

Books

is a comprehensive book on getting a job at a top tech company, while focuses on dev interviews and does this for PMs.

Learn More

Videos

CareerCup's interview videos give you a real-life look at technical interviews. In these unscripted videos, watch how other candidates handle tough questions and how the interviewer thinks about their performance.

Learn More

Resume Review

Most engineers make critical mistakes on their resumes -- we can fix your resume with our custom resume review service. And, we use fellow engineers as our resume reviewers, so you can be sure that we "get" what you're saying.

Learn More

Mock Interviews

Our Mock Interviews will be conducted "in character" just like a real interview, and can focus on whatever topics you want. All our interviewers have worked for Microsoft, Google or Amazon, you know you'll get a true-to-life experience.

Learn More