Amazon Interview Question for Software Engineer / Developers


Country: -
Interview Type: Phone Interview




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

How about a link list of free parking numbers. Whenever we need a parking, delete the first/last node and whenever we get a parking back, add it at the front/end.

- Anonymous November 11, 2011 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

i want whole code for a running car parking lot if somebody have the full code of car parking lot then plz send me at my email:-wahabsaleem18@hotmail.com

- Zohaib feroz May 22, 2012 | Flag
Comment hidden because of low score. Click to expand.
1
of 1 vote

An Array would be good enough

- Rohan December 18, 2011 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

linklist should do....

- dilkash.rocks January 26, 2012 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

Queue

- Anonymous October 17, 2011 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Queue is not good. because Car is the middle of queue is stuck.

- amitduapec October 17, 2011 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

How is this very different from a heap allocation ?

- Ram October 18, 2011 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

Heap might not work, as removing an only max or min which ever condition is used to build the heap is allowed to be removed not any element.
Hash would be an ideal data structure. Park the car sequentially in the hash array and return the index and the car number. while taking the car way just pass the car number and index to the car away. parking O(n) and removing O(1)

- Anonymous October 18, 2011 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 votes

How about Hash or simple two dimensional array? A parking make have rows and each row contain number of slots.

- M October 18, 2011 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

i think hash table is the correct answer. But dictionary is a better data structure than hash tables as it performs all the functionality of hash table and has performance better than hash table.
So I would suggest using dictionary.

- sportivepersonality October 26, 2011 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

linklist should do......

- dilkash.rocks January 26, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Multilist!

- Harjit Singh April 23, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

anybody know full coding about car parking by using data structre please email to me..haziela93@yahoo.com..very urgent...please

- Anonymous September 10, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

i want auto parking program

- mohit singh April 02, 2015 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

HashSet would be good enough.

- Samir January 03, 2018 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Heap is the appropriate solution when we want to find the nearest available slot. When parking a vehicle, remove the slot from the heap and insert back when removing the vehicle.
Both parking and removing could be done in O(Log(n)), where n is the number of available parking slots.

- shivanshgaur19 August 07, 2019 | Flag Reply
Comment hidden because of low score. Click to expand.
-1
of 1 vote

Stack:

Slot # = 1 2 3 4 5… n
All slots are free currently....
FreeStack = n n-1 n-2 n-3….. 1 // Note its the reverse of Slot # which are free

-------------------------------- Arrivals----------------
1st car – Slot 1
FreeStack.Pop()
.
.
Nth car – Slot N
FreeStack.Pop()

ParkingFull =1;
------------------------------------------Car Leaving----------------------------------------------
Car at Slot #‘i1’ leaves:
FreeStack.Push(i1); ParkingFull =0;
.
.
Car Slot # ‘i8’ leaves:
FreeStack.Push(i8)
-------------------------------------------New car Arrives----------------------------------------
Goes to the Slot # pointed by the top of the stack (FreeStack.Top()).
FreeStack.Push();


O(1) Complexity..

- HuggableAtol February 27, 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