Amazon Interview Question Software Engineer / Developers


Country: United States
Interview Type: Phone Interview


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

1. Create a class for the vehicle:

public class vehicle{
       private String vehicle_num;
       private String OwnerName;
       private long ownerCellno;
       private String inTime;
       private String outTime;
       //create the getters and setters for the above fields
    }

2. Create a HashMap:
HashMap<Vehicle, Integer> parkDetail = new HashMap<Vehicle, Integer>();
where the second Integer field is the parkingspot ID.
//This HashMap will keep the details of the occupied parking slots.

3. Create a Queue of Integer which will be used to track the free parking spots, when a parking spot gets free...add it to the queue....If a new vehicle has come den remove the corresponding entry from this queue and add it to hashMap.

For 4 wheeler and 2 wheeler, we can maintain two copies of HashMap and Queue as there will be different parking spots for both.

- A on January 10, 2013 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

enum CarType{ car, mobile};
Class Vehicle{
CarType _type;
string owner;
int RestTime;

}
class ParkingLot{
int CarPosition;
int MotorPosition;

- Calvin on October 30, 2011 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

enum CarType{ car, mobile};
Class Vehicle{
CarType _type;
string owner;
int RestTime;

}
class ParkingLot{
int CarPosition;
int MotorPosition;

- Calvin on October 30, 2011 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

class Vehicle{}
class Car: public Vehicle {}
class Motor: public Vehicle{}
class Slot
{
Vehicle* pVehicle;
}

- xiaofeng.ustc on February 06, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

class Vehicle{}
class Car: public Vehicle {}
class Motor: public Vehicle{}
class Slot
{
Vehicle* pVehicle;
}

- xiaofeng.ustc on February 06, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Some questions needs to be asked --- Are both expected to consume the same amount of space? (It may be desirable that a different parking lot or a different level or a selected area be designated for Motorcycle parking).
Other important point that needs consideration are duration of parking and payment, Type of parking spot (Regular, Valet or for Handicapped - More classes can be added).

- akashcpatel on July 23, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
Comment hidden because of low score. Click to expand.
0
of 0 votes

Fail!!!

- noMAD on March 29, 2012 | Flag


Add a Comment
Name:

Writing Code? Surround your code with {{{ and }}} to preserve whitespace.

Books

is a comprehensive book walking you through 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