Amazon Interview Question for Data Scientists


Country: United States




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

I would probe before answering this question first
1> What kinda database (dynamo or RDBMS)
2> What does unsold item mean? It it depend on the unaltered quantity of items after listing for a certain duration of days?

Having asked that, any approach can gives me this solution but thinking in worst case scenario, I would say.

1> Take snapshot of each database.
2> For each category,
For each item in the category
{if item.quantity(listedDate) == item.quaniity(currentDate)}
{{list.add(item) // item as unsold }}

// Algo runs over O(n) for n numbers of items

- hprem991 June 21, 2016 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Lets say there are three items . so

1.Take these three items in hashmap/dictionary(python)
2.Put unsold=1
3.Traverse through the hashmap and if the item is sold put unsold as 0
4.Repeat 3 for all the items
5.Once all the items been marked as unsold/sold traverse through the hashmap and find an entry with unsold stilll equal to 1.
6.The item is 5 is unsold so can be printed.

- chaturvedi.naina0412 June 20, 2016 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

- Let's say we have 100 Product , so we can make bool array of 100 elements
bool arr[100];
int item;
- next we add sold item first
for (int i = 0 ; i < 100 ; ++i)
{
cin >> item;
arr[item] = 1;
}
- then we make another loop printing
for (int i = 0 ; i < 100 ; ++i)
{
if (arr[i] == 0) cout << "item number" << i+1<<"is not sold";
}
Algo O(n)

- Anonymous June 21, 2016 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

How about...

Select * from
Item_table
Where initial_quantity-final_quantity = 0;

- Venkat parkunan March 16, 2017 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Select * from
Item_table
Where initial_quantity-final_quantity = 0;

- Venkat parkunan March 16, 2017 | Flag Reply
Comment hidden because of low score. Click to expand.
-1
of 1 vote

.

- Anonymous June 21, 2016 | Flag Reply
Comment hidden because of low score. Click to expand.
-1
of 1 vote

mmmmm

- Anonymous June 21, 2016 | 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