Recently helped a trainee brush up on a set of ByteDance Online Assessment, the time is 9.10, I just finished the test that day and I will share the latest situation ~ ByteDance’s OA platform is still CodeSignal and it is similar to the familiar Uber / Roblox / HRT / TT general question bank. The overall mode is 70 minutes of 4 questions. So if you have done OA for these companies before, the types of questions and routines you encounter are basically the same. The overall difficulty is not explosive, but if you want to complete AC in 70 minutes, you still need to be familiar with CodeSignal's question types in advance, especially the boundary and corner cases that 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 with frantically reading the question bank, what really widens the gap is actually on-the-spot performance. We can help you point out the details in actual practice, such as when to skip questions and where to make up edge cases. One less pitfall may lead to one more AC question. These small details often determine whether you can advance to the next round. If you are also preparing for OA from ByteDance, Uber, HRT, Roblox or other major manufacturers, don’t force yourself, we have it here OA remote invisible interview assistance + Substitute interview, allowing you to adapt to the auxiliary rhythm in advance just like a real interview. Students in need can come to us directly to chat, avoid detours, and seize the opportunity.