TikTok SDE OA 2025 四题全绿|28分钟速通 + 真题解析 + 秋招趋势

627閱讀
沒有評論

这周刚带学员做完 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
正文完
 0