最近投遞了 Apple SWE New Grad 崗位,大概兩週後收到了 recruiter 發來的 OA 邀請郵件。郵件裡附的是 HackerRank 測試連結,比較友好的一點是:有 7 天時間視窗可以自由選擇開始時間。但需要注意,一旦點選 start,計時就會立刻開始,中途不能暫停。
我當時特意選了週末上午做題——腦子最清醒的時候確實更容易進入狀態。開始前我還簡單熱身了幾道題,把 IDE、草稿紙都準備好,避免正式開始後手忙腳亂。

Apple OA 題目回顧
兩道題按順序解鎖,做完第一題才能看到第二題。整體節奏很重要,建議每題不超過 40 分鐘,留 10 分鐘檢查邊界情況。
Maximum Profit in Job Scheduling
Easy-Medium
We have n jobs, where every job is scheduled to be done from startTime[i] to endTime[i], obtaining a profit of profit[i].
You’re given the startTime, endTime and profit arrays, return the maximum profit you can take such that there are no two jobs in the subset with overlapping time range.
If you choose a job that ends at time X you will be able to start another job that starts at time X.
Example 1:

Input: startTime = [1,2,3,3], endTime = [3,4,5,6], profit = [50,10,40,70]
Output: 120
Explanation: The subset chosen is the first and fourth job.
Time range [1-3]+[3-6] , we get profit of 120 = 50 + 70.
Example 2:

Input: startTime = [1,2,3,4,6], endTime = [3,5,10,6,9], profit = [20,20,100,70,60]
Output: 150
Explanation: The subset chosen is the first, fourth and fifth job.
Profit obtained 150 = 20 + 70 + 60.
Example 3:

Input: startTime = [1,1,1], endTime = [2,3,4], profit = [5,6,4]
Output: 6
Constraints:
1 <= startTime.length == endTime.length == profit.length <= 5 * 1041 <= startTime[i] < endTime[i] <= 1091 <= profit[i] <= 104
Sum Root to Leaf Numbers
Medium
You are given the root of a binary tree containing digits from 0 to 9 only.
Each root-to-leaf path in the tree represents a number.
- For example, the root-to-leaf path
1 -> 2 -> 3represents the number123.
Return the total sum of all root-to-leaf numbers. Test cases are generated so that the answer will fit in a 32-bit integer.
A leaf node is a node with no children.
Example 1:

Input: root = [1,2,3]
Output: 25
Explanation:
The root-to-leaf path 1->2 represents the number 12.
The root-to-leaf path 1->3 represents the number 13.
Therefore, sum = 12 + 13 = 25.
Example 2:

Input: root = [4,9,0,5,1]
Output: 1026
Explanation:
The root-to-leaf path 4->9->5 represents the number 495.
The root-to-leaf path 4->9->1 represents the number 491.
The root-to-leaf path 4->0 represents the number 40.
Therefore, sum = 495 + 491 + 40 = 1026.
Constraints:
- The number of nodes in the tree is in the range
[1, 1000]. 0 <= Node.val <= 9- The depth of the tree will not exceed
10.
90 分鐘時間分配建議
0 – 5 min:仔細閱讀題目,確認輸入輸出格式和邊界條件,不要急著寫程式碼。
5 – 35 min:完成第一題,先寫暴力解確保透過,再考慮最佳化。提交前跑一遍自己設計的邊界 case。
35 – 75 min:完成第二題,同樣先求 AC 再最佳化。注意不要被某個 bug 卡死太久,超過 10 分鐘沒思路可先跳回審題。
75 – 90 min:整體複查:檢查邊界(空陣列、負數、全相同元素),確保所有可見 case 全透過後提交。
OA 之後的流程
提交 OA 後大約等了 10 天收到了 Phone Screen 的邀請。後續使用的是 CoderPad 平臺,和 OA 的 HackerRank 風格略有不同,可以實時看到程式碼執行結果並與面試官互動。
推薦刷題資源
LeetCode Apple Tag
最直接的方式,按照 Apple 高頻題刷即可,陣列、DP、二分、圖論出現頻率都不低。
NeetCode 150
適合系統性補基礎,影片講解比較友好。
CodeTop
國內整理的大廠高頻題庫,更新速度很快。
一畝三分地
很多最新 OA 面經和 timeline 分享。
ProgramHelp
如果你最近同時在準備 Apple、Meta、Amazon、Google 等多家公司的 OA,時間比較緊,自己刷題效率不高,也可以找 ProgramHelp 做針對性的 實時OA助攻 。