I’ve been doing a lot of OA recently, and this one Google The overall experience is still evaluated in one sentence: the number of questions is small, but the cost of thinking is not low.
It's not the kind of OA that can be mastered by relying on hand speed or routines. Especially the first question, there are too many rules, and it is easy to end up in a dead end if you think wrongly. There are two questions in OA this time. The time itself is not tight, but the requirements for thinking are relatively high. It belongs to the type where it goes smoothly when you think about it right, but you get stuck when you think wrongly.
The first question: chess piece jumping + coin maximization
The question gives a string as a chessboard, where T Represents chess pieces,C Represents coins,. Indicates an empty space. Each chess piece can only move to the right, and must jump exactly 3 squares each time. It can jump multiple times in a row, but it cannot fall on a position where other chess pieces already exist.如果落在硬币上,就可以收集该硬币,每个硬币只能被收集一次,最终目标是最多能收集多少个硬币。
It is easy to get sidetracked at the beginning of this question, such as trying to plan all the chess pieces in a unified manner, do global optimal matching, or even lean on DP, but in fact these ideas will complicate the problem. The key is that the position that each chess piece can reach is completely determined, and it can only be to the right of the current position. I+3, i+6, i+9... These points.
A more stable approach is to scan each chess piece from left to right and process it in order. For the current chess piece, only look for unused coins in the positions it can jump to, and give priority to the leftmost one. Once the match is successful, the chess piece is considered to have completed the task and will no longer jump to the right. At the same time, the corresponding coin is marked as used.
The intuition for this is that the earlier and further to the left the coin is used, the more space available for the pieces behind it. This is a very typical greedy scenario, using local optimality to avoid subsequent conflicts. When actually writing code, as long as the two states of "chess piece occupation" and "whether the coin has been collected" are clearly handled, the overall logic will be very smooth.
Question 2: The largest subset of shared numbers
The second question is much easier overall. The question gives an array containing two-digit numbers from 10 to 99. You can choose a group of numbers, require that all the numbers in this group share at least one same number (any one from 0 to 9), and ask how many can be selected at most.
At first glance, it seems to be testing subsets or combinations, but in fact the condition is very simple: as long as there is a certain number d, so that all the selected numbers contain this d, the requirement is met. In other words, the problem can be directly transformed into: for each number 0–9, count how many numbers in the array contain it.
The specific method is to enumerate from 0 to 9, scan the array each time, count the number of elements containing the current number, and finally take the maximum value. As long as you think clearly that "sharing a number" is equivalent to "screening around a fixed number", this question is basically a pure counting question.
Summarize feelings
This time Google OA feels very typical: there are not many questions, but each one requires you to judge the essence of the problem quickly enough. The first question is more focused on rule understanding and whether the greedy strategy is correct, while the second question tests whether you can quickly break down abstract conditions into enumerable and statistical forms.
The overall difficulty level is not outrageous, but it is definitely not the kind of OA that can be stably passed by just completing the number of questions. If you are currently preparing for online assessments from Google or other major manufacturers, it is really worth practicing these types of questions with "many rules but not complicated solutions" to avoid being bypassed in the exam room.
In real scenarios, what many people lack is not practice questions
For this kind of OA/Live Coding scenario, Programhelp provides practical remote assistance support. What many students really need is not to answer a few more questions, but to have someone pull you back during the 5 minutes when it is easiest to think wrong. If you are currently stuck in the critical stage of OA, VO or on-site coding at a large manufacturer,OA traceless assistance In actual combat, it can indeed significantly reduce the probability of rollover, at least it will not lose in the most regrettable place of complicated thinking.