Recently, I guided a student through the Uber Online Assessment. The structure was pretty typical: three coding questions with a strict time limit. As with many recent sessions, Uber has moved their OA from CodeSignal to HackerRank this year.
We went through it in a remote real-time assistance mode, pacing the student steadily. In about 30 minutes, all three questions were completed successfully with all test cases passing. Here’s a breakdown of the question types and strategies we used.
Question 1: Python: Lambda Map
Problem: Given a 2D array, for each sub-array, filter out all positive integers, then square them, and return the resulting 2D array.
Approach: This mainly tests familiarity with Python’s functional programming style. You can use map to iterate through sub-arrays, filter to keep positive numbers, and then map again to square them. Finally, convert the result back to a list.
The focus here isn’t algorithmic complexity, but knowing how to use lambda, map, and filter. If you’re comfortable with functional style, this can be done in a single line.
Question 2: Node Disconnection
Problem: Given a string, you can remove a contiguous segment of identical characters in one operation. Determine the minimum number of operations to remove the entire string.
Approach: The key is understanding the operation: a contiguous segment can be deleted in one step. So the problem reduces to counting the number of contiguous segments.
Implementation is straightforward: scan the string left to right. Each time the current character differs from the previous one, it’s a new segment—increment a counter. Linear scan, O(n) complexity, is enough.
Many people try to simulate deletion, but it’s unnecessary—just count segments.
Question 3: Purchase Optimization
Problem: You are given a price array prices, a starting position pos, and a total budget amount. Starting from pos, buy items sequentially as long as the remaining budget allows. Return the total number of items purchased.
Approach: This is a classic sequential greedy problem. Iterate from pos, buy if the budget is enough, update remaining budget and count, and stop when you can’t afford the next item. Time complexity is O(n).
Not familiar with OA? Don’t worry
If you’re about to take the Uber OA and aren’t confident with HackerRank or other online assessment platforms, there’s no need to panic. You can prepare by practicing with someone experienced who can guide you through timing and question patterns.
We provide long-term guidance for students on various company OAs, including HackerRank and CodeSignal. If you feel uncertain doing it alone, check out our remote voice assistance service to help you navigate the assessment smoothly.
Top comments (0)