Uber VO Coding Interview|Three Questions + Summary of practical work to avoid pitfalls

631 Views

这场 Uber 's Virtual Onsite (Coding session) was one of the most impressive I've led in recent memory.
45 minutes, 3 questions ranging from Algorithm basics to SQL & Pandas to cohort analysis, with almost no wasted topics. For anyone looking to break into Uber DS / Scientist / DE positions, this set of questions is worth breaking down carefully.

Uber VO Coding Interview|Three Questions + Summary of practical work to avoid pitfalls

Question 1: Implement sqrt() without using any external library

Requirements: implement a function to calculate the square root without using any library function sqrt(x).

The trainee was stuck here, and wrote a straightforward 0-to-x/2 grid searchThe interviewer said, "Although the logic is fine, the complexity is O(n), and it can't run with a large number of inputs. The interviewer didn't interrupt right away, but the expression on his face already said it all.

The correct thinking should be:

  • Use binary search Do a bisection lookup.
  • each time you take mid = (left + right) / 2judgement mid * mid with respect to x, and keep shrinking the interval until the error is small enough.
  • If decimals are allowed, set the precision to 1e-6.

It's not really about implementing square roots, it's about constructing your own algorithmic ideas, and Uber loves to come up with handwritten "no library functions allowed" questions like log(), pow(), sqrt(), and abs(), which rely on the algorithmic logic in your head.

Question 2: Identify the top three drivers in each city who made the most money last month

The table structure is as follows:

(driver_id, date, trip_id, payment, city_id, is_completed)

Ask to find the "top three drivers who made the most money in each city last month" using SQL or pandas.

This question has a strong Uber flavor at first glance - it's very business oriented, but it's really about your proficiency in data grouping + ranking functions.

SQL Writeup:

WITH monthly AS (
  SELECT
    city_id, driver_id
    city_id, driver_id, SUM(payment) AS total_payment
    SUM(payment) AS total_payment
  FROM trips
  WHERE date >= DATE_TRUNC('month', CURRENT_DATE - interval '1 month')
    AND date < DATE_TRUNC('month', CURRENT_DATE)
    AND is_completed = TRUE
  GROUP BY city_id, driver_id
)
SELECT *
FROM (
  SELECT
    city_id, driver_id, total_payment, ROW_NUMBER(
    ROW_NUMBER() OVER(PARTITION BY city_id ORDER BY total_payment DESC) AS rn
  FROM monthly
) t
WHERE rn <= 3.

Interviewer focus look:

  • You are interested in the window function (ROW_NUMBER, RANK, DENSE_RANK) Proficiency or lack thereof
  • Flexibility to reproduce SQL logic in Pandas
  • Whether filtering conditions have been considered (e.g. is_completed = TRUE)

Question 3: Of the drivers who signup each month, identify the top three highest earners in each city.

Add a new table:

(driver_id, signup_date)

Require:

Find the top three drivers who make the most money in each city among the drivers who sign-up each month.

This question is an advanced version of the second question, with the additional cohort dimension of "signup_month", which Uber likes to test, especially in Scientist interviews.

SQL Solution:

WITH cohort AS (
  SELECT
    s.driver_id,
    DATE_TRUNC('month', s.signup_date) AS signup_month,
    d.city_id, SUM(d.payment) AS total payment
    SUM(d.payment) AS total_payment
  FROM trips d
  JOIN signup s
    ON d.driver_id = s.driver_id
  WHERE d.is_completed = TRUE
  GROUP BY 1,2,3
),
ranked AS (
  SELECT
    *SELECT
    ROW_NUMBER() OVER(PARTITION BY signup_month, city_id ORDER BY total_payment DESC) AS rn
  FROM cohort
)
SELECT *
FROM ranked
WHERE rn <= 3;

This question is at the heart of the test:

  • Can you understand the cohort logic of "registered driver of the month"?
  • Can you combine two tables correctly (join + grouping + window functions)
  • There's no business sense, like filtering out unfinished orders.

Many candidates get stuck here after writing the second question, in fact the logic is the same as long as you aggregate and then group and sort.

Test Logic for Uber Interviews

In those 45 minutes, Uber is actually testing three competencies:

  1. algorithmic thinking -- Math implementations that do not rely on library functions
  2. SQL / Pandas Practical Skills -- Ability to handle large-scale transaction data
  3. Cohort Analytical Awareness -- cohort performance with enrollment and order data

The overall difficulty level is medium to high, but the proficiency level is extremely high. If you haven't brushed up on similar questions in advance, it will be difficult to write them all in 45 minutes.

Programhelp Guaranteeing your success

We were remotely assisted throughout this VO, especially in the second and third question sections.

  • When the trainees began to write in pandas sorting logic mixed up, we voice reminds the groupby + rank usage, immediately pull back the rhythm;
  • In the cohort section of question 3, we hinted at "to use signup_month + city_id double dimensional partitioning" to avoid rank errors.

Finally managed to pass all three questions.

Programhelp's remote voice-assisted service specializes in Uber / DoorDash / Lyft / Amazon / Instacart OA + VO hands-on chaperone for data and algorithmic posts such as these.
Through real-time voice prompts and seamless online assistance, we can help you stabilize your output at critical moments, so that you can go from "knowing how to write" to "really being able to write at the interview site".

author avatar
Jory Wang Amazon Senior Software Development Engineer
Amazon senior engineer, focusing on the research and development of infrastructure core systems, with rich practical experience in system scalability, reliability and cost optimization. Currently focusing on FAANG SDE interview coaching, helping 30+ candidates successfully obtain L5/L6 Offers within one year.
END