Today’s sharing is from a classmate who is studying for a master’s degree in computer science in North America. He usually takes about 200+ questions on LeetCode, and his target position is Databricks Software Engineer. This test lasts for 70 minutes and has a total of 4 questions. The overall difficulty is medium. The first two questions are close to LeetCode easy and can basically be completed relatively quickly. The last two questions are medium difficulty and require a little more thinking. Let’s sort out the overall structure and question types of this OA, as a reference for students preparing for Databricks SDE later.

Odd and even position elements and comparison
Question description
Given an array of integers Numbers, comparing the sum of elements at even positions (0-based index) with the sum of elements at odd positions:
- If the sum of the elements at even positions is greater, return
"even" - If the sum of elements at odd positions is greater, return
"odd" - If the two are equal, return
"equal"
Illustrate
- The position here is the 0-based index (that is, the first element of the array is at position 0).
- Example:
Numbers = [1, 2, 3, 4, 5]- Even positions (0, 2, 4):
1 + 3 + 5 = 9 - Odd positions (1, 3):
2 + 4 = 6 - Because
9>6, so the output"even"
- Even positions (0, 2, 4):
Numbers = [-1, 4, 3, -2]- Even positions (0, 2):
-1 + 3 = 2 - Odd positions (1, 3):
4 + (-2) = 2 - Because
2 = 2, so the output"equal"
- Even positions (0, 2):
- The time complexity does not exceed O(n²) It can be passed (n is the length of the array).
Unix command execution count statistics
Question description
In Unix systems, there are two common ways to execute commands:
- Enter the command name directly, for example
Cp,Ls,Mv; - Enter
!Instructions in the format used to repeatedly execute the index (1-base index) command after the start of this session.
For example, the user enters the following commands in sequence:
Ls → Cp → Mv → Mv → Mv → !1 → !3 → !6
!1Command 1 will be executed repeatedlyLs!3Command 3 will be executed repeatedlyMv!6Order 6 will be executed first!1, thus triggering the execution ofLs
Given a sequence of commands Commands, where each command can only be "cp","ls","mv" Or "!" Format.
Please calculate Cp,Ls,Mv The total number of times the three commands are actually executed, and returns the form: [cp times, ls times, mv times] Array of integers.
Note: It can be passed if the time complexity does not exceed O (n³).
Statistics of the longest continuous housing segment
Question description
You are monitoring building density in a residential area. The residential area can be viewed as a number line, and houses can only be built at a location if at least one adjacent point is unoccupied. Initially, there are no houses in the area.
Given an array of integers Queries, indicating in sequence the locations of new houses to be built. After each house is built, you need to find the longest continuous length of house segments in the current area.
Returns an array of integers where each element corresponds to Queries The longest continuous segment length of each house in the building after it is built.
Notice:
- All
QueriesThe locations of the houses in are all unique; - It is guaranteed that no new houses will be built where there are existing houses at adjacent points to the left and right.
Example
Enter:Queries = [2, 1, 3]
Output:[1, 2, 3]
Sum of digital strings in reverse order bit by bit
Question description
Given two numeric strings A And B, calculate the sum of each bit according to the following rules and return the result string:
- Starting from the end, add the first two strings
IAdding digits; - If the first of one of the strings
IIf the bit does not exist, directly take the first bit of another string.IBit as sum; - Concatenate the sum of all bits in order into a new string and return it.
Example
Sheet
Enter A |
Enter B |
Output | Illustrate |
|---|---|---|---|
"99" |
"99" |
"1818" |
From back to front:9+9=18,9+9=18 → Spliced into "1818" |
"11" |
"9" |
"110" |
From back to front:1+9=10,1(The second string has no second digit) → concatenated into "110" |
A bit of real advice
Finally, the student was successfully promoted to VO. In fact, it’s not that many students can’t do the questions, but that it’s easy to get stuck in the OA environment: they suddenly find bugs in the middle of writing, fail to handle boundary conditions well, or start to panic when time is tight. This situation is particularly common in the 70-minute four-question OA. So many people will look for it in advance Interview assistance Preparing together is often just one click away, which is much more efficient than being stuck thinking about it for half an hour.