Recently helped a trainee brush up on a set of ByteDance Online Assessment, on 9.10, I just finished the test on that day, so I'm here to share the latest situation.
ByteDance's OA platform is still CodeSignal, which is similar to the familiar Uber / Roblox / HRT / TT set of general questions, and the overall pattern is 4 questions in 70 minutes. So if you've done OA for these companies before, you'll basically encounter the same question types and patterns.
The feeling of this measurement:
- Time is really tight, and you can't get too stuck writing 4 questions.
- There is a high degree of overlap in the question pool, but the values and details change a bit each time and cannot be copied exactly.
- The questions are skewed towards classical data structures + simulations such as array, string, greedy, small dp.
The overall difficulty is not explosive, but in order to get all ACs in 70 minutes, you should familiarize yourself with CodeSignal's question sets in advance, especially boundary and corner cases, which are easy to fall into.
ByteDance Online Assessment Exclusive question reproduction
Problem 1: Maximum Square Area in City Skyline
You need to analyze the potential space in a cityscape outlined by a series of skyscrapers. Each element in the array cityline represents the height of a skyscraper, with each skyscraper having a width of 1. They are placed directly adjacent to each other along a road with no gaps. Your task is to determine the largest square area that can fit within this row of skyscrapers.
Example
- For
cityline = [1, 2, 3, 2, 1], the output ofsolution(cityline)should be4.
In this configuration, there are multiple 2×2 squares that can be accommodated between the skyscrapers, but no larger square can fit due to height The following are some of the most important features of the skyscrapers
Problem 2: Number of Nearly Regular Crosses
For a rectangular matrix of integers, a cross is a figure formed by the intersection of one row and one column. A cross is considered regular if all its For a rectangular matrix of integers, a cross is a figure formed by the intersection of one row and one column.
A nearly regular cross is one where all elements are equal except possibly the element at the intersection of the row and column that form the cross.
Given a rectangular matrix of integers matrix, your task is to return the number of nearly regular crosses in the matrix. Note that by definition, regular crosses are also considered nearly regular crosses.
Note: You are not expected to provide the most optimal solution, but a solution with a time complexity no worse than O(matrix.length - matrix[0].length - (matrix.length + matrix[0].length)) will fit within the execution time limit.
Example
For
matrix = [
[1, 4, 1, 1]
]
the output should be 10.
Explanation: There are 10 crosses in this matrix that meet the definition of a nearly regular cross. For example, the cross formed by row 0 and column 0, where elements other than the intersection meet the conditions; the cross formed by row 2 and column 2, where all elements are equal (a regular cross) and for example, the cross formed by row 0 and column 0, where elements other than the intersection meet the conditions; the cross formed by row 2 and column 2, where all elements are equal (a regular cross) and thus counted as a nearly regular cross. thus counted as a nearly regular cross. The total count is 10.
Problem 3: Optimal String Reversal
Given a string word, you can form new strings by reversing the order of some characters from the beginning or the end of word.
Reversing the first k characters of a string |w₀...wₖ₋₂wₖ₋₁|wₖ...wₙ ₋₁ (where the part within |...| is reversed) results in |wₖ₋₁wₖ₋₂...w₀|wₖ...wₙ ₋₁.
Reversing the last k characters of a string w₀...wₙ₋ₖ₋₁|wₙ₋ₖw ₙ₋ₖ₊₁...wₙ₋₁| (where the part within |...| is reversed) results in w₀...wₙ₋ₖ₋₁|wₙ₋₁...w ₙ₋ₖ₊₁wₙ₋ₖ|.
Your task is to iterate over all possible new strings that can be formed this way and return the lexicographically smallest one.
Note: You are not expected to provide the most optimal solution, but a solution with a time complexity no worse than O(word.length³) will fit within the execution time limit.
Example
For word = "dbaca", the output of solution(word) should be "abdca".
All possible reversal operations are as follows.
Reversing the first 1 character results in "dbaca".
Reversing the first 2 characters results in "bdaca".
Reversing the first 3 characters results in "abdca".
Reversing the first 4 characters results in "cabda".
Reversing the first 5 characters results in "acabd".
Reversing the last 1 character results in "dbaca".
Reversing the last 2 characters: the last 2 characters of the original string are "ca", which become "ac", after reversal, resulting in inversion of the last 2 characters. " after reversal, resulting in "dbaca".
Reversing the last 3 characters: the last 3 characters of the original string are "aca", which remain "aca " after reversal, resulting in "dbaca".
Reversing the last 4 characters: the last 4 characters of the original string are "baca", which become "acab " after reversal, resulting in "dacab".
Reversing the last 5 characters (reversing the entire string) results in "acabd".
Among all possible results, the lexicographically smallest is "abdca".
Exam preparation advice
Brush up on generic questions: Focus on CodeSignal high-frequency questions, especially array + string permutations.
Training for writing speed: Usually it's best to just stick to 70min for simulations and force yourself to debug quickly.
Attention to test cases: Write a few more extreme cases, such as empty array / maximum value / single character.
preserve the state of mind: When you get stuck on a question, don't beat a dead horse, skip to the next question first to ensure your overall score.
Language Selection: If C++ / Java is proficient, use these in preference for stable performance; Python needs to prepare optimization means in advance.
Double your efficiency with a running partner
Compared to brushing up on the question bank, what really opens up the gap is actually the performance in the field. We can help you point out the details in the actual battle, such as when to skip questions, where to make up the edge case, less fall out of the pit may be more AC a question. These small details often determine whether you can enter the next round. If you are also preparing for ByteDance, Uber, HRT, Roblox or other large OA, don't be hard to carry on, we have OA remote interview assistance without traces + generation interviews, so that you can adapt to the rhythm of assistance in advance like a real interview. If you need it, you can come to talk to us directly, so as to minimize the detour and grasp the opportunity in your hand.