Microsoft Interview Question for Software Engineer in Tests






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

The interviewer was expecting some Datastructure implementation,I started saying all the datastructures i know:)..I used N-ary tree for Included and excluded list

root
.com .net
.test .abc .xyz .*

I would create a tree from input string and would find if the tree is subtree of the Included and Excluded trees and respective heights which determine the best match..I am sure this is the worst way of doing it, any other DS implementations here..

- C# September 04, 2010 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

How do you know the interviewer was expecting some data structure implementation?

- Anonymous September 04, 2010 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

I was asked to think of any other efficient data structure to implement this..

- c# September 04, 2010 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

Create 2 suffix tree(1 for inclusion and other for exclusion) with all these inputs in reverse order
eg
Suffix tree input will be
moc. [this is for .com]
moc.tset. [this is for test.com]
ni.oc

Reverse the input and check for its presence in this suffix tree and calculate the length matched as well.

Search for string in suffix tree will be taking O(n) time, n being the length of the input to be searched

- DashDash September 04, 2010 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

nice approach!!!

- anonymous September 04, 2010 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 votes

how do you take care of patterns?

- guestMB September 06, 2010 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 votes

when traveling the suffix tree, and we hit a '*", it means it matches in this suffix tree and we do not need to travel much deeper in the suffix tree.

- Anonymous September 08, 2010 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 votes

Not really...
Input can be like porn.*.com in which case we should go deeper.

Am I missing something?

- Mahesh September 09, 2010 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 votes

Ok, the question doesn't say that input can have wild cards!

Nice solution.

- Mahesh September 09, 2010 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

maintain two table one for inclusion and one for exclusion
then check url's extension (.com,.test.com etc) so complexity will be O(n1)+O(n2) which will be O(n) if n1=n2=n

- ramu kumar September 07, 2010 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

according to the question, *.com < *.test.com when matching to xxx.test.server.com

so the best match is *.test.com instead of *.com

if you use a trie you can't find the match *.test.com

- Anonymous March 05, 2011 | 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