Microsoft Interview Question for Software Engineer in Tests


Country: United States




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

BFS algorithm should work for this.

- Anonymous November 16, 2011 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

DFS can also work

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

DFS will not work here... BFS provides the answer to the single source shortest path problem

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

shortest path with DP.

- __coder November 16, 2011 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

we need to find all routes, not only the shortest route.

- roosted.glory November 26, 2011 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

Easy using recursive methods but checking circle is tricky...
void FindPaths(const string& source, const string& dest, list<string>& path)
{
path.push_back(source);
if(source == dest)
{
PrintPath(path);
path.pop_back();
return;
}

list<string> destList = RetriveDestinations(source);
for(list<string>::const_iterator iter = destList.begin(); iter != destList.end(); ++iter)
{
if(find(path.begin(), path.end(), *iter) != path.end())
{
continue;
}
else
{
FindPaths(*iter, dest, path);
}
}

path.pop_back();
}

- liming November 16, 2011 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Very good solution using recursion.
wgfa.blogspot.com/2005/07/all-paths-between-two-nodes-in.html

- Raju May 18, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
-1
of 1 vote

This is a graph problem.
I think the finding the minimum spanning tree gives the best path and
finding all the spanning trees gives u the all the routes.

- DNS November 18, 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