解析 Uber 的 OA 面试

uber的岗位只开放了2天就被候选人们冲爆,很多信息渠道不通畅的同学们痛失做OA的机会。

收到了OA的同学们你们都是好样的!说明你们都是积极关注招聘信息的同学,秋招快人一步。

对此次OA的我们的判断是属于白嫖OA,因为几乎每个候选人都收到了同样的OA。

本次OA的题型是4个算法题,限时70分钟,4道算法题大概是3个e~m + 1个hard题构成,由codesignal 题库中随机选择。这意味着大家不能像之前Amazon的OA那样看我们的share来答题了。

The next step is to complete an onlinecoding assessment; we have partneredwith CodeSignal as our testing platform tofacilitate that. This coding assessment willassess your general CS fundamentals. Youmay utilize the coding language of yourchoice to work on the problem.
Upon following the link, if you don't have aCodeSignal account, you will be promptedto create one, Please be aware that the linkto this CodeSignal test will open onThursday, June 27, 2024 at midnightPacific Time and expires 4 days frominvitation.
Please use the same email you'veused to apply to our roles at Uber tocreate your CodeSignal account (fortracking purposes).
Uber Coding Assessment (click here)

题目难度还是相当高的,P2 P3是我们的老师在做题的时候碰到的比较有意思的题型

Uber's Online Assessment (OA) is a crucial step in the recruitment process for many technical candidates. This assessment is designed to test candidates' programming skills and problem-solving abilities. Typically, Uber's OA consists of four algorithm questions of varying difficulty, with a time limit of 70 minutes.

以下是两道 Uber OA 题目的原文描述:

Here are the descriptions of two Uber OA questions:

题目 1:
You are given a matrix of integers matrix, containing only zeros and ones.

Let's call an "X-shape" a figure with a center at some cell of matrix and 4 diagonal rays of equal length. The X-shape is called perfect if all its elements equal 1.

For example, there is one perfect X-shaped figure of size 2 with a center at [1, 1], and five perfect X-shaped figures of size 1 in the following matrix:

[[1, 0, 1],
[0, 1, 0],
[1, 0, 1]]

At the same time, the following matrix has only four perfect X-shaped figures of size 1:

[[1, 1],
[1, 1]]

Return the center coordinates [row, col] of the largest perfect X-shaped figure within the matrix. If there are multiple answers, then return the answer with the minimal row value first, and if there is still a tie, then return the answer with the minimal column value.

题目 2:

For an array nums and an integer t (0 ≤ t < nums.length), let's define a cyclic t-shift operation as carrying t elements from the beginning of the array to the end.

For example, applying cyclic t-shift to array nums having values [nums[0], nums[1], nums[2], ..., nums[n-1]], where n is the length of the array:

- For t = 0, the cyclic 0-shift will be [nums[0], nums[1], nums[2], ..., nums[n-1]]
- For t = 1, the cyclic 1-shift will be [nums[1], nums[2], ..., nums[n-1], nums[0]]
- For t = 2, the cyclic 2-shift will be [nums[2], ..., nums[n-1], nums[0], nums[1]]
- ...
- For t = n-1, the cyclic (n-1)-shift will be [nums[n-1], nums[0], nums[1], ..., nums[n-2]]

For example, the video below presents all cyclic t-shifts of the array [3, 4, 5, 1, 2]:

Return the smallest integer t such that the cyclic t-shifted array is sorted in non-decreasing order. If there is no such t, return -1.

解题思路分享

题目 1 解题思路:

对于第一道题,我们需要在一个由0和1组成的矩阵中找到最大的完美X形。一个完美X形要求其对角线上所有元素均为1。我们可以通过动态规划的方法来解决这个问题。具体来说,可以通过遍历矩阵的每个元素来计算以该元素为中心的最大X形的大小,并记录最大的X形及其中心坐标。

题目 2 解题思路:

对于第二道题,我们需要在一个数组中找到一个使其循环移位后按非递减顺序排列的最小移位数。一个有效的解决方法是遍历每一种移位情况,并检查其是否满足非递减顺序的条件。我们可以通过模拟移位并检查排序来完成这一任务。

联系我们

如果您在准备 Uber 的 OA 或其他技术面试中需要帮助,我们提供 OA 代写服务、面试辅助服务等一系列支持。我们的专家团队将帮助您提高通过率,顺利拿到心仪的 offer。欢迎联系我们了解更多信息!

Solution Approach

Question 1 Solution Approach:

For the first question, we need to find the largest perfect X-shape in a matrix of zeros and ones. A perfect X-shape requires all elements along its diagonals to be ones. We can solve this using a dynamic programming approach. Specifically, by iterating through each element of the matrix, we can calculate the size of the largest X-shape centered at that element and keep track of the largest X-shape and its center coordinates.

Question 2 Solution Approach:

For the second question, we need to find the smallest shift that makes the array sorted in non-decreasing order. A practical solution involves iterating through each possible shift and checking if the resulting array is sorted. This can be done by simulating the shift and verifying the sorted condition.

Contact Us

If you need assistance preparing for Uber's OA or other technical interviews, we offer a range of services, including OA writing assistance and interview support. Our team of experts will help you increase your chances of success and secure your desired offer. Contact us to learn more!

Leave a Reply

Your email address will not be published. Required fields are marked *