Amazon Interview Question for Software Engineer / Developers


Country: India




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

Divide and conquer ? Have elevators that operate 40 and under and 40 and above. Then you are effectively managing 40 and 35 floors respectively. Similarly, if you have 40 floors, you can have one lift that operates first 20 and last 20. So you can have 1-20, 20-40, 40-60 and 60-80. By any reasonable logic you can manage 20 floors by 1 elevator. Normally there are 4 elevators in most large buildings. So this fits well...

- Ashish Kaila December 02, 2011 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

But in the case of a person going from ground floor to top floor, he would have to change lifts 4 times! Is that workable?

- tiputiger December 05, 2011 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

@Ashish:
I think some assumptions are also has to be taken:
For e.g.: There can be multiple entrance of building. Each entrance will have atleast 2 lifts. Moreover, if a single lift would service 20floors than the waiting time would be quite high. Also, there might be some executive floors which requires a good lift service(2-3 three special lifts for their floor to sub floors).
More assumption can also be added.

- Shwetank December 02, 2011 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

This is a skip list problem.

- superman December 03, 2011 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

@Shwetank
Definitely a candidate must ask lot of open ended questions while forming his/her assumptions. This also disables interviewer in contradicting assumptions.

@Superman
Yes indeed skip list is what I have. I was thinking about even-odd or skipping 2, 3 and 5 floors but it seems given large number of floors a person would have to think/walk a lot to figure out the right lift. Hence 20 floor skip.

- Ashish Kaila December 04, 2011 | Flag Reply
Comment hidden because of low score. Click to expand.
-1
of 1 vote

I would answer smthing like this:

N lifts,
(Roughly)
M lifts that go to all floors.
N/2 - M/2 only for even floors
N/2 - M/2 only for odd floors
And say,


(both will go to ground floor and basement)

Now what N & M should be ? 75 floor building. If its a office building, perhaps, too much of movement.

On avg, smooth would be, one lift to cater to say 3-4 floors.

So, N = 75/3-4 = (rougly) 20

So, for M, required when one wants to go from odd to evn or vice versa. Around 2.
(if distance is large, I'd prefer going to nearest even / odd floor, and then take stairs for one floor. )

SO, estimate is 9 lifts for even floors, 9 lifts for odd floors, and 2 lifts tht go to all floors !!

- P December 08, 2011 | 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