Uber Interview Question for Software Engineers


Country: United States
Interview Type: In-Person




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

Looking for interview experience sharing and coaching?

Visit aonecode.com for private lessons by FB, Google and Uber engineers

Our ONE TO ONE class offers

SYSTEM DESIGN Courses (highly recommended for candidates for FLAG & U)
ALGORITHMS (conquer DP, Greedy, Graph, Advanced Algos & Clean Coding),
latest interview questions sorted by companies,
mock interviews.

Our students got hired from G, U, FB, Amazon, LinkedIn and other top tier companies after weeks of training.

Feel free to email us aonecoding@gmail.com with any questions. Thanks!

Solution to 2/5: The number of minutes in a day is constant. Create an array of size 60*24 minutes in a day. Mark true on meeting schedules.

public boolean meetingOverlap(int[][] meetings) {
        boolean[] schedule = new boolean[24 * 60];
        for(int[] time:meetings) {
            for(int i = time[0]; i <= time[1]; i++) {
                if(schedule[i]) return true;
                schedule[i] = true;
            }
        }
        return false;
    }

- aonecoding July 20, 2017 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

There is another very neat alternative than creating a large boolean bucket array, radix sort.

// radix_sort is Theta(n)
def radix_sort(meetings){
  // all of these, by definition will have same no digits :: max 4  
  no_digits = size ( meetings[0].start, 10 )
  for ( inx : [no_digits-1:-1] ){
    bucket = mset ( meetings ) as { int ( (str($.start))[inx] ?? 0 ) }
    meetings = fold( [0:10] ,list() ) as { 
      continue( $.o !@ bucket )  
      $.p += bucket[$.o] }
  }
  meetings // return 
}
def is_overlap(meetings){
  meetings = radix_sort(meetings)
  exists ( [1:size(meetings)] ) where {
    meetings[$.o - 1].end >= meetings[$.o].start   
  }
}

- NoOne July 21, 2017 | 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