Uber OA interview experience sharing|Quick review of three high-frequency questions and analysis

68 Views
No Comment

Passed recently Uber OA, the overall difficulty of this round of questions is not particularly high, but it is a test of modeling ability and clarity of thinking. Many questions may not seem complicated, but it will be very time-consuming if you go in the wrong direction, so record the questions and core solutions while they are hot.

Uber OA timeline reference

01/22 Apply

01/29 Received OA

01/29 Completed OA

02/05 Immigration Assessment

02/08 Make an appointment (Uber’s process is very fast, and HR is so awesome.)

Uber OA real test questions review

Question 1|How many products can you buy at most within your budget?

Question meaning
There is an array of commodity prices that has been sorted, and the prices do not decrease from left to right. Alex starts from the given position pos and walks to the right. He buys at most one item from each stall and asks how many items he can buy at most without exceeding the budget amount.

Ideas
The prices have been sorted, and the optimal strategy must be to buy the cheaper ones first.
Start directly from the POS and add up the prices sequentially. Buy as much as you can until the total price exceeds the budget.
The implementation can be linearly scanned; if you want to optimize, do the prefix sum first, and then use bisection to find the farthest position.

Question 2|Supports updated fixed and paired statistics

Question meaning
Given two arrays primary and secondary.
Operations are divided into two categories: one is to update the value of a certain position in the secondary, and the other is to query to satisfy
Primary[i] + secondary[j] = number of pairs of targetSum.

Ideas
The point is to avoid doing a double loop for every query.
Use a hash table to maintain the number of occurrences of each value in secondary, and synchronize the modification count when updating.
When querying, traverse primary, and for each value x, directly check targetSum in the hash table – how many x there are, and the answer is the accumulation.
Fast updates and stable queries.

Question 3 | Optimal time selection for elevator + stairs

Question meaning
You can choose to take the elevator to a certain floor i, and then take the stairs from i to the end point.
The elevator stage consumes time and increases energy, while the stair stage consumes energy and the time spent on each floor is related to the current energy. The energy cannot be negative during the process.
The goal is to minimize the total time spent.

Ideas
This is a typical enumeration breakpoint problem.
Enumerate the situation where the elevator stops at the i-th floor, first calculate the time and remaining energy of the elevator stage, and then simulate the time it takes to take the stairs from i to the end point.
As long as the energy is never less than 0 during the process, it is a legal solution. Record the corresponding time and finally choose the optimal solution.
The whole process can be completed in one round of enumeration.

Learn more

If you are not sure about the passing rate of OA, or are worried about getting stuck on key questions, it is actually more stable to rely on a mature experience system in advance. We have been sorting out OA question types and common routines from major manufacturers for a long time, and have actually helped hundreds of students smoothly advance the process and land in major manufacturers. Students who need help in sorting out high-frequency questions and thinking, or want to improve their OA pass rate, are welcome to do so at any time. Contact us Learn more.

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
 0