Amazon Interview Question for Software Engineer / Developers


Country: United States
Interview Type: In-Person




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

I can relate this to a graph's shortest path problem.

book -> movie -> pizza , These could be the nodes of a graphs.

And from book you have to reach at pizza via some shortest path.

- guptasunny158 September 22, 2013 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

What are the data structures holding this information?

I don't think all of these things are in the same graph, because there are different categories of objects here, and they are related "loosely" by "recommendations."

Did they tell you how it's all organized? Or did they want you to think of a way?

"Recommendation" part of the "hop" is usually not a simple edge.

- bigphatkdawg September 22, 2013 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

A BFS could show minimum hops for reaching another page from a source page.

- Myth September 23, 2013 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

It looks more like a shortest path problem between two nodes in a tree. We may have to make custom data-structures to represent those nodes(products) & mark them as they are visited along with their distances from start. Add the neighbours to a "to be visited" queue and perform the same on them.

- Itanium September 23, 2013 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

Why is it necessarily a tree? Graph is better to denote the relationship.

- Daniel Yin September 25, 2013 | Flag


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