Amazon Interview Question for SDE-2s


Team: Transportation Team
Country: India
Interview Type: In-Person




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

Okay lets break the problem down. Begin with calcuation
1. Visit one site (1 URL)
2. Go through all of its images, mark them V Good - Poor and calculate some sort of average. We will need some scale of marking. So lets take: V Good = 4, Good = 3, Avg = 2, Poor = 1
S = Total score of the URL, N = Total number of images on the URL

S = 0; N = 0;
   for (i = next image in URL; i < Last image in URL; i++)
   {
 	//take next image say I
	S = S + ScoreOf(I);
	N++;
   }
   
   Avg_Score_For_URL = S / N;

3. Now to store the score of a website. Use a hashtable/ STP map which takes key-val pairs.
So key = URL, value = Avg_Score_For_URL. This will also serve as a check for already visited URL's. Before visiting a URL check if its entry already exists in the hashtable.

This would be a very basic solution.

- puneet.sohi June 15, 2015 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

This is a standard graph traversal problem. In that Each URL is a node and set of images on each node is data on which certain processing is to be done.
We can use BFS or DFS for traversal of the URL. We can define size of the image as a metric to judge quality of image. So that more the size of the image better it would be. Now, make few buckets of size and assign an integer to them. For example: image of size range 4-6 mb would be average so number 2 could be assigned. Image with size less than 10 kb would below good so number 0 can assigned.

After traversing through all the images, we can get average value of the image quality.

I have provided just a basic idea. Otherwise there could be n number of ways in which we could get image quality.

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

This is a standard graph traversal problem. In that Each URL is a node and set of images on each node is data on which certain processing is to be done.
We can use BFS or DFS for traversal of the URL. We can define size of the image as a metric to judge quality of image. So that more the size of the image better it would be. Now, make few buckets of size and assign an integer to them. For example: image of size range 4-6 mb would be average so number 2 could be assigned. Image with size less than 10 kb would below good so number 0 can assigned.

After traversing through all the images, we can get average value of the image quality.

I have provided just a basic idea. Otherwise there could be n number of ways in which we could get image quality.

- Anonymous June 22, 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