Amazon Interview Question for Principal Software Engineers


Country: United States
Interview Type: In-Person




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

public class Customer{
	
	private int userId;
	private int numberOfPersons;	
	private Location location;
	private Vehicle vehicle;
	private Queue<Message> messageQueue;

	public Customer(int userId, int number){...}
	
	public void setLocation(Location location){...}
	
	public void setVehicle(Vehicle vehicle){...}
	
	public void setNumberOfPersons(int number){...}
	
	public Location getLocation(){...}
	
	public Vehicle getVehicle(){...} 
	
	public void getNumberOfPersons(){...}
	
	public void receiveMessage(Message message){ 
		messageQueue.add(message);
	}
	
	public Message sendMessage(){		
		return messageQueue.poll();		
	}
}

public class Vehicle{
	
	private int vehicleId;	
	private Location location;	
	private int availableSeats;	
	private ArrayList<Customer> customersToPick;	
	private Queue<Message> messageQueue;
	
	public Vehicle(int vehicleId, State state){...}

	public void setSeats(int seats){...}
	
	public void setLocation(Location location){...}

	public void addCustomer(Customer person){...}
	
	public void dropCustomer(Customer person){...}
	
	public Location getLocation(){...}
	
	public Customer getNearestCustomer(){...}	
	
	public int getSeats(){...}
	
	public void receiveMessage(Message message){ 
		messageQueue.add(message);
	}
	
	public Message sendMessage(){		
		return messageQueue.poll();		
	}
	
}

public class LocationBase{
	
	private int baseId;	
	private Location location;	
	private int radius;			// the radius that the base can cover
	
	ArrayList<Customer> customers;
	ArrayList<Vehicle> vehicles;
	
	Queue<Message> messages;
	
	public LocationBase(){
		customers = new ArrayList<Customer>();
		vehicles = new ArrayList<Vehicle>();
	}
	
	// set the location for location base
	public void setLocation(Location location){...}
	
	// add a customer
	public void addCustomersInRange(Customer customer){...}	
		
	// update the locations of customers
	public void updateCustomerLocation(){...}
	
	// the customer goes out of the range
	public void removeCustomerInRange(Customer customer){...}	
	
	// add a vehicle
	public void addVehicleInRange(Vehicle v){...}
	
	// the vehicle goes out of the range
	public void removeVehicleInRange(Vehicle v){...}		
	
	// update the locations of vehicles
	public void updateVehicleLocation(){...}	
	
	// send message to vehicle or to customer if messages queue is not empty
	public void sendMessage(){...}			
	
	// receive message from vehicle or from customer, push it to message queue
	public void receiveMessage(Message message){...}		
	
	// find a vehicle in the range of the base and assign a customer to it
	public boolean connectCustomerToVehicle(){...}
	
	// use a vehicle from another area
	public void connectCustomerToVehicle(Vehicle v){...}

}

public class Network{

	private ArrayList<LocationBase> network;
	
	private int numberOfBases;
	
	public Network(){}
	
	...	

}

- PoWerOnOff December 13, 2015 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Hi There,

In total awe…. So much respect and gratitude to you folks for Amazon Interview Question for Principal Software Engineers without missing any points on the Distributed vs Parallel computing. Kudos!

I know that you may answer as already in such case that you noticed that I open case 4914182641 in support center and that I need to wait their answer. But when I opened it, I start to search such problems with overdue payments on forums. And I found that everytime people said that they not get answer from support (from 48 hours to 1 week). I'm very affraid that in my case support cannot react same as I read it from forums. And that my account can be closed. It's really little sum (approx. 8 EUR for february) and very big time of use (many years). I create domain's there and buckets. And it's very affraid to lost account such way. Can you, please, help me?

Amazon S3 provides access to reliable and inexpensive data storage infrastructure. It is designed to make web-scale computing easier by enabling you to store and retrieve any amount of data, at any time, from within Amazon EC2 or anywhere on the web.

But nice Article Mate! Great Information! Keep up the good work!

Kind Regards,
Kevin

- Kevin June 02, 2018 | 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