Amazon Interview Question for Software Engineer / Developers


Country: India
Interview Type: In-Person




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

What was your approach ?

My approach :

Take two points, one will be center , the other will lie on the circumference, 
   then find out the equation of circle, then iteration through all points to find whether it is on circle or not. Then maximum of all the answers.

Time : O(n^3) .

- mkagenius April 11, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

Well I told that I will create a hashmap, with every cordinate and distance as key and count of eqidistance point as valus. then finally the key for the entry in Hash map with max count will be centre and distance for that hash map will be the radius of the circle. Then I was asked to code for the same.

- vivekanand3435 April 13, 2012 | Flag
Comment hidden because of low score. Click to expand.
-1
of 1 vote

Non optimum solution:
1) Consider any point and find the farthest point from this point.
2) Make this point as center and draw a circle with farthest point distance as radius.
Complexity: O(N)

Optimum soln:
1) Calculate Nc2: Distance between all pairs of points and find max distance.
2) Make one of these points as center and draw a circle with distance between two as radius.
Complexity: O(N^2)

- SkyCaptain April 11, 2012 | 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