is a comprehensive book on getting a job at a top tech company, while focuses on dev interviews and does this for PMs.
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.
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.
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.
Your solution complexity is big.
- viktor.kolodrevskiy March 02, 2013This one is O = nm
public class FindMaxPersons {
public static void main(String[] args) {
List<PersonTime> data = new ArrayList<PersonTime>();
data.add(new PersonTime(0,3));
data.add(new PersonTime(2,3));
data.add(new PersonTime(0,4));
data.add(new PersonTime(1,3));
data.add(new PersonTime(3,5));
data.add(new PersonTime(3,6));
data.add(new PersonTime(4,5));
int maxTime = 0, maxPerson = 0;
for (int i = 0; i < 10; i++) {
int tempMaxPerson = 0;
for (PersonTime pt: data) {
if(pt.arrivalTime <= i && pt.departureTime >= i) {
tempMaxPerson ++;
}
}
if(tempMaxPerson > maxPerson) {
maxPerson = tempMaxPerson;
maxTime = i;
}
}
System.out.format("time is %d, max person is %d", maxTime, maxPerson);
}
private static class PersonTime {
int arrivalTime;
int departureTime;
public PersonTime(int arrivalTime, int departureTime){
this.arrivalTime = arrivalTime;
this.departureTime = departureTime;
}
}
}