OA Aid | White Weed Uber OA?Simple as opening a paper! (High-frequency question analysis and solutions included at the end of the article)

1,220 Views
No Comment

Uber OA has always been the "meat and potatoes" for tech job seekers because it's relatively friendly, the questions are fixed, and it's almost an "open book" if you're well-prepared. If you are preparing for Uber's OA, this article is your secret to pass!

OA Aid | White Weed Uber OA?Simple as opening a paper! (High-frequency question analysis and solutions are included at the end of the article)

Uber OA Difficulty Analysis: the old ways, brush up and take it

Uber OA time is 70 minutes, a total of 4 questions, the difficulty distribution is usually 2 Easy + 2 Medium, the topic mainly examines the math, algorithms, data structures and programming fundamentals, the question type is basically a variation of the classic algorithm questions. In other words, as long as you brush up enough high-frequency questions on LeetCode, Uber's OA is basically a "white gripping" opportunity!

According to the feedback from past candidates, Uber's OA questions do not seek innovation, but are more about examining candidates' proficiency in basic algorithms. In other words, as long as you master common algorithmic templates, such as sliding windows, double pointers, dynamic programming, tree traversal, etc., you can basically deal with it easily.

High-frequency questions and solutions: the core exam of Uber OA

followingUber OAThe questions and solutions that appear with high frequency in the book are recommended to be bookmarked!

1. Array and string manipulation

  • Typical topics:
    • string inversion: Examines basic operations, but may add additional conditions, such as reversing word order.
    • Write a function that reverses the order of words in a given string. It is required that the words in the returned string be in the reversed order, separated by a single space only, and not contain any extra spaces.
OA Aid | White Weed Uber OA?Simple as opening a paper! (High-frequency question analysis and solutions are included at the end of the article)
request
The input string may contain leading and trailing or multiple spaced spaces.
The returned string should be stripped of leading and trailing spaces and ensure that words are separated by only one space.
Please try to implement this feature without using extra space
  • Ideas For Solving The Problem:
  1. Remove extra spaces: Iterates through the string, copying valid characters (non-spaces) and words to a new location, removing extra spaces.
  2. Reverse the entire string: Reverse the processed string as a whole so that the order of the words is reversed.
  3. Reverse each word: Reverses word by word in the reversed string to restore the correct order within the words.

Complete code implementation:

# Remove extra space
s = list(s)
s = list(s) left, right = 0, 0
n = len(s)
while right < n.
    if s[right] ! = ' ': if left !
        if left ! = 0: s[left] = ': if left !
            s[left] = ' '
            s[left] = '': if s[right] ! = 0: s[left] = '
        while right < n and s[right] ! = ' ': s[left] = s[right].
            s[left] = s[right]
            s[left] = s[right]
            right += 1
    right += 1
        right += 1
s = s[:left]

# Reverse the entire string
s.reverse()

# Reverse each word
left, right = 0, 0
while right < len(s): while right < len(s) and s[right] !
    while right < len(s) and s[right] ! = ' '.
        right += 1
    temp = s[left:right]
    temp.reverse()
    s[left:right] = temp
    s[left:right] = temp
    left = right

return ''.join(s)

2. Traversal of chained tables and trees

  • Typical topics:
    • Maximum depth of a binary tree: recursive or iterative implementation.

Write a function that calculates the maximum depth of a given binary tree. The maximum depth of a binary tree is the number of nodes on the longest path from the root node to the farthest leaf node.

Example:

Given binary tree: [3,9,20,null,null,15,7]

3
/ \
9  20
   / \
 15   7

Returns its maximum depth: 3.

Require:

  • Please use recursive or iterative methods to achieve this.
  • Please add appropriate comments to the code to explain the key steps.
  • Ideas For Solving The Problem:

Method 1: Recursive realization

The recursive method calculates the maximum depth by decomposing the problem. The depth of each node is equal to the maximum of the depths of its left and right subtrees plus one.

  • Recursive termination condition: if node is empty, return depth is 0.
  • Recursively calculates the depth of the left and right subtrees, takes the maximum value and adds 1 (the depth of the current node).

Method 2: Iterative implementation (hierarchical traversal)

Hierarchical traversal (BFS) using queues to compute depth layer by layer.

  • Hierarchical traversal using queues.
  • Each time a layer of nodes is processed, the depth is added by 1.
  • When the queue is empty, the traversal completes and the depth is returned.

3. Dynamic programming and greedy algorithms

  • Typical topics:
    • Stair climbing problems: Introductory questions on classical dynamic programming.
    • Maximum subarray and: either greedy or dynamic programming can solve it.
    • change: A variant of the complete backpack problem.
  • Ideas For Solving The Problem:
    • Dynamic planning questions begin with a clear definition of state and transfer equations.
    • The greedy algorithm needs to prove whether a locally optimal solution can derive a globally optimal solution.

4. Sorting and searching

  • Typical topics:
    • binary search: Examine the treatment of boundary conditions.
    • rapid sorting: Common problems with handwritten sorting algorithms.
    • merger interval (math.): The classical problem of sorted post-processing.
  • Ideas For Solving The Problem:
    • Dichotomous Finding Note the definition of intervals that are left-closed and right-open or left-closed and right-closed.
    • Sorting questions usually require handwritten algorithms, with attention to stability requirements.

How to prepare for Uber OA efficiently?

  1. Recommended Brushup Platforms:
    • LeetCode: focus on brushing Easy and Medium difficulty questions, especially the high-frequency question types mentioned above.
    • Power Buckle (LeetCode China): Chinese language support, suitable for domestic job seekers.
  2. Time Management Skills:
    • Uber OA's 70 minutes need to be allocated well, suggesting 15-20 minutes per question, leaving 5-10 minutes for checking at the end.
    • Do the questions you are familiar with first to ensure that you maximize your score.
  3. mock:
    • Complete the simulation questions within the allotted time and get used to the speed of coding in a high-pressure environment.

Conclusion: Uber OA is a "white weed" opportunity, don't miss it!

Uber's OA is not very difficult and you can basically pass it with ease if you prepare well. The high-frequency questions have been organized for you, and all that's left is to brush up and practice. If you need a more detailed question bank and solution code, you can click herecontact usGet the full information or join our preparation group to sprint through Uber with other job seekers!

author avatar
azn7u2@gmail.com
END
 0
Comment(No Comment)