2026 TikTok Intern OA 一次過|CodeSignal 四道題思路全分享

127 Views
No Comment

剛做完 TikTok 2026 Intern 的 OA,這一場整體體驗非常順。題目看起來字很多,但真正理解之後,四道題 50 分鐘是完全夠用的。這場我基本是按題序一路寫完,中途沒有卡太久,最後還留了時間整體檢查一遍,最終一次過。

OA 基本情況

平臺是 CodeSignal。一共四道題,限時 50 分鐘。

整體感覺是 TikTok 這套 OA 並不依賴他們自己的老題庫,而是更偏 CodeSignal 原生風格。題面描述偏長,但核心邏輯都不繞,只要思路清楚,實現速度會非常快。

四道題思路分享

T1:評分 / 價格最大值

2026 TikTok Intern OA 一次過|CodeSignal 四道題思路全分享

You are given two arrays, one representing product ratings and one representing product prices. It is required to find the product with the largest rating divided by price. If there are multiple items, return the one with the smallest index. The method is very straightforward, just use a for loop to traverse all the products. To avoid precision problems caused by using double, you can multiply the left and right sides of the inequality by the denominator at the same time and use integers for comparison. The essence of this question is linear scanning. Whoever thinks about the comparison method first can finish it quickly.

T2:借車走到終點

從 0 出發走到終點,路上有多輛車。每輛車最多可以帶你走 10 米,你走到車的位置就可以使用它,問最終在車上行駛的總距離是多少。

My approach is to sort the positions of all cars first and then handle them greedily. Each time a usable car is encountered, the end point of the journey is set to min(finish, x + 10). Note that this car can only be used if its position is no less than its current location. As long as you have reached the end point, you can end it directly.

T3:電池輪換使用問題

2026 TikTok Intern OA 一次過|CodeSignal 四道題思路全分享

你需要使用手機 t 分鐘,手上有 n 塊電池,每塊電池的容量和充電速度都不同。電池沒電後可以充電,問最少需要多少塊初始滿電的電池,才能支撐用完這 t 分鐘。

The core of this question is to simulate the entire usage process. Use the batteries in sequence and record when each battery is fully charged. Every time you need to replace a battery, go to the next battery that is fully charged at the current time. If no available fully charged battery is found at a certain point in time, it means that the task cannot be completed and a failure will be returned directly.

T4:動態維護最長連續區間

題目會動態地新增位置點。每新增一個點,都需要返回當前最長的連續段長度。

This question just uses a hash table to maintain the length of the left and right endpoints of each continuous segment. Each time a new position is inserted, check whether the adjacent positions on the left and right exist. If they exist, merge the intervals and update the length of the new interval. Just maintain a global maximum value during the entire process.

總結

The characteristics of this set of TikTok OA are very obvious: the questions are long, but the logic is clear; it does not rely on memorizing the question bank, but more on thinking and implementation speed.

如果你平時對 CodeSignal 題型比較熟,四道題在 50 分鐘內寫完是完全可行的。重點還是前期想清楚,再動手寫,後面才能留出時間做整體檢查。

關於 OA 的一些現實經驗

In fact, after doing it, you will find that OA with 50 minutes and 4 questions like TikTok is never just a test of whether you can do it, but whether you can press the time, whether the idea can be in place at once, and whether there is room for error.

如果你正在準備大廠 OA / Intern / New Grad 筆試,但遇到過下面這些情況,其實都很正常:

  • 題不算難,但時間不夠
  • 思路是對的,最後幾個 test case 老是不過
  • 平時會寫,線上評測一緊張就容易出 bug

我這邊後來接觸到的是 OA 代寫 / Dachang Written Test / HackerRank is a professional online evaluation service, covering common platforms including HackerRank, Niuke.com, CodeSignal, etc. The overall model is to achieve traceless operations through remote control and complete OA without affecting account security. Service standards are also relatively clear:
所有測試用例 100% 透過才算完成,不透過不收費。

author avatar
Jory Wang Amazon資深軟體開發工程師
Amazon 資深工程師,專注 基礎設施核心系統研發,在系統可擴充套件性、可靠性及成本最佳化方面具備豐富實戰經驗。 目前聚焦 FAANG SDE 面試輔導,一年內助力 30+ 位候選人成功斬獲 L5 / L6 Offer。
END
 0