最近幫學員刷到了一套 ByteDance Online Assessment ,時間是 9.10,當天剛測完就來分享一下最新情況~
ByteDance 的 OA 平台依舊是 CodeSignal,跟大家熟悉的 Uber / Roblox / HRT / TT 那套通用題庫差不多,整體模式就是 70 分鐘 4 道題。 所以如果你之前做過這些公司的 OA,遇到的題型和套路基本八九不離十。
這次測下來的感覺:
- 時間確實比較緊,寫 4 道題不能有太多卡頓。
- 題庫重疊度高,但每次數值和細節會有點變化,不能完全照搬。
- 出題思路偏經典數據結構+類比,比如 array、string、greedy、小 dp。
整體難度不算爆炸,但要想 70 分鐘全 AC,還是要提前熟悉 CodeSignal 的題型套路,尤其是邊界和 corner case,容易掉坑。
ByteDance Online Assessment 獨家真題複現
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 heightlimitations.
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 itselements are equal.
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 regularcrosses.
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, 1, 1, 1],
[2, 3, 1, 1],
[1, 1, 1, 0],
[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) andthus 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 "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".
備考建議
刷通用題庫:重點看 CodeSignal 高頻題,尤其是陣列 + 字串的變形題。
訓練寫題速度:平時類比最好就卡在 70min,強迫自己快速 debug。
注意 測試用例:多寫幾個極端 case,比如空陣列 / 最大值 / 單字元等。
保持心態:有一道題卡住,不要死磕,先跳到下一題,保證整體分數。
語言選擇:如果 C++ / Java 熟練,優先用這些,性能穩定; Python 需要提前準備優化手段。
有陪跑,效率翻倍
比起狂刷题库,真正拉开差距的其实是临场表现。我们能在实战中帮你点出细节,比如什么时候该跳题、哪里要补 edge case,少掉一次坑就可能多 AC 一题。这些小细节,往往决定了能不能进下一轮。如果你也在准备 ByteDance、Uber、HRT、Roblox 或其他大厂 OA,别硬扛,我们这边有 OA远程无痕面试助攻 + 代面试,让你像真实面试一样提前适应辅助节奏。有需要的同学可以直接来找我们聊,少走弯路,把机会抓在手里。