TikTok SDE OA 2025 四題全綠|28 分鐘速通 + 真題解析 + 秋招趨勢

這周剛帶學員做完 TikTok 的 SDE OA(Online Assessment),整套下來感覺節奏非常舒服。
一共有四道程式設計題,整體難度不高,屬於那種“題型熟、實現細”的組合。
我全程用了 28 分鐘,四題一次性全 AC 。 下面是完整題目和我的復盤分享。

T1 Monotonic Triplets

Problem Statement (in English):
You are given an array of integers arr. Your task is to determine whether each sequence of three elements in the array (arr[i], arr[i + 1], and arr[i + 2]) are monotonic.
Three consecutive elements are monotonic if their values are in a strictly increasing or strictly decreasing order.
Return an array of integers of length arr.length - 2, where the i-th element is equal to 1 if arr[i] < arr[i + 1] < arr[i + 2] or arr[i] > arr[i + 1] > arr[i + 2], and 0 otherwise.

Example:

arr = [1, 2, 1, -4, 5, 10]
output = [0, 1, 0, 1]

這個題基本上是熱身題,遍曆所有三元組即可。
判斷條件簡單,用 O(n) 時間就能搞定,幾乎沒有陷阱。

T2 Deck Shuffle

Problem Statement (in English):
You have a deck of cards numbered from 1 to n, where n is the total number of cards.
The cards are currently arranged in some order, and you want to sort them in ascending order (1, 2, 3, …, n).
The only operation you can perform is a shuffle move: take k cards from the top of the deck and move them to the bottom, where k is any integer from 0 to n– 1.

Example:

arr = [5, 1, 2, 3, 4]

類比所有可能的 k 值(0 到 n−1),執行一次移動操作,看是否能變成 [1, 2, 3, …, n]
實現上很直接,只要邏輯寫對就能一次通過。
TikTok OA 很喜歡這種“看似抽象、實則枚舉”的題,關鍵是細心。

T3 Race Elimination

Problem Statement (in English):
All the competitors in a stock car race have completed their qualifying laps. Each lap, the driver with the current slowest “best” time is eliminated (that is, the highest personal best time).
If multiple drivers tie for the slowest time, they are all eliminated.
You are given a two-dimensional string array with each driver’s name and lap time in seconds for each lap.
Your task is to return the drivers in the order in which they were eliminated, ending with the last driver or drivers remaining.
When multiple drivers are eliminated on the same lap, their names should be listed alphabetically.

Example:

laps = [
  ["Harold 154", "Gina 155", "Juan 160"],
  ["Juan 152", "Gina 153", "Harold 160"],
  ["Harold 148", "Gina 150", "Juan 151"]
]
output = ["Juan", "Harold", "Gina"]

這道題更像一個完整模擬題,考察字典、字串解析和排序的綜合能力。
每輪更新選手的 best time,然後找出最慢的(值最大)淘汰。
一旦理解邏輯,實現其實並不複雜。

T4 Counting Black Squares

Problem Statement (in English):
For a grid of black and white cells with rows rows and cols columns, you’re given an array black that contains the [row, column] coordinates of all the black cells in the grid.
Your task is to compute how many 2 x 2 submatrices of the grid contain exactly blackCount black cells, for each 0 ≤ blackCount ≤ 4.
As a result, you will return an array of 5 integers, where the i-th element is the number of 2 x 2 submatrices with exactly i black cells.

Example:

rows = 3, cols = 3, black = [[0, 0], [0, 1], [1, 0]]
output = [1, 2, 0, 1, 0]

這題偏向計算類,思路是:
每個黑格最多出現在四個 2×2 子矩陣中,
枚舉所有可能的起點 (r, c),計算其中黑格的數量即可。
實現上用哈希集合存儲黑格位置,遍歷範圍小,時間很容易控制在 O(rows × cols)。

總體感受

整套 TikTok OA 的題型偏常規,沒有演算法陷阱。
四道題的難度分佈合理,分別覆蓋了:

  • 陣列基礎邏輯
  • 類比與枚舉
  • 狀態更新與排序
  • 二維遍歷與計數

我這次在 Codesignal 環境中全部順利 AC,用時 28 分鐘。
對比去年題庫,這一輪的題目更注重 coding correctness 而不是 tricky logic。

Programhelp 即時無痕助攻體驗

如果你最近也在準備 TikTok OA 或其他大廠筆試,可以提前練習類似題型,
或者直接找 Programhelp 助攻,保證無壓力拿下。

  • 即時語音提醒卡點思路(如」判斷條件寫反了「這種關鍵提示)
  • 類比類題提前幫你確認邏輯框架
  • 多平台環境同步(Codesignal / HackerRank / Codility)
  • 所有操作不留痕跡,100% 安全

我們已經幫過不少同學拿下 TikTok、Uber、Capital One、Snowflake 等大廠的 OA。
無論是秋招、春招,還是內推測試階段,都能穩穩通過。

author avatar
jor jor
END
 0