Amazon Interview Question for SDE-2s


Country: India




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

This is minimum set cover problem, I think.
Each seller can "cover" a set of products.
We have to find the minimum number of sellers to cover all required products.

Minimum Set Cover is a NP-hard problem.

Thus, if we want to find optimal solution, heuristic should be used. Or transform it into an integer linear programming instance, then use ILP solver to solve.

If we want to find some approximated solution, greedy may work fine.

- ninhnnsoc February 26, 2015 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

is this a multiple set cover problem ? I mean, acc. to it we would need a subset of items (in the cart) such that the union equals to total number of sellers. That said, we may exclude some items in the cart.

- Rajat July 26, 2015 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 votes

It can be a set cover problem if our universe={P1, P2, ..., Pn} and we turn the product/seller mappings over so that 1={P1}, 2={P1, P2}, ... Then we can find the minimum sellers to cover the product universe.

Not many products and sellers so probably just make it a simple combinatoric problem saving only the minimum set of sellers.

- theclish August 10, 2015 | Flag
Comment hidden because of low score. Click to expand.
1
of 1 vote

apply dynamic programming, find minimum number of sellers for just product sets of {P1, P2, P3, etc...}, then find minimum for sets of {(P1, P2), (P1, P3), etc...} using previously found values.

- abhinav neela February 26, 2015 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

Hey Abhinav,Can you explain the same in detail.

- Algorithmist February 27, 2015 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

for get the minimum delivery man , find the intersection of the P1 and P2...
but i have doubt in complexity in the logic
please correct me if i am wrong...

- sumit.polite February 26, 2015 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

use minimum cover algo to find the approximate solution.(DP or greedy)

- Atul Gupta February 28, 2015 | 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