Uber Interview Question for Software Engineers


Country: United States
Interview Type: Phone Interview




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

public Cab{//Used by cab driver through mobile/web  root is fixed for all from/to pair
			//halting stops are also fixed

	private int vehicleNo;
	private String from;
	private String to;
	private String currentLocation;//milliseconds
	private boolean sharable;//Sharable or not
	//send the above info to uber onetime
	public boolean sendInfoToUberRestService(){
	//This method updates data for the ConcurrentHashMap i.e. locationCabs, in class 
	//SharedCabscatalog
	}
	public boolean sendCurrentLocation(){//every 2 minute/configurable
	}
	public void refreshData(){//called after every trip
	}
	public boolean book(int time, String from, String to){
	//if sharable, still seat available and yet has not reached from then book it
	}
}   

public SharedCabscatalog{//Updated every 2 minutes
	//seperate java process for every city
	//For each location all vehicle numbers which are on the way to reach this location
	//The location may not be the destination. It may be in the mid way
	private ConcurrentHashMap<String,ArrayList<Integer>> locationCabs;

	public int[]  cabAvailability(String from, String to, int time){
		//check locationCabs and see if from and to contains same vehiclenumber
		//return that
	}

	public boolean update(String from, String to, int vehicleNumber){
	//used by the webservice call from the cab
	}
public boolean book(String from, String to, int vNo){
//call webservice to book the cab
}

}

- s100banerjee April 27, 2015 | 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