最近投递了 Apple SWE New Grad 岗位,大概两周后收到了 recruiter 发来的 OA 邀请邮件。邮件里附的是 HackerRank 测试链接,比较友好的一点是:有 7 天时间窗口可以自由选择开始时间。但需要注意,一旦点击 start,计时就会立刻开始,中途不能暂停。
我当时特意选了周末上午做题——脑子最清醒的时候确实更容易进入状态。开始前我还简单热身了几道题,把 IDE、草稿纸都准备好,避免正式开始后手忙脚乱。
Apple OA 题目回顾
两道题按顺序解锁,做完第一题才能看到第二题。整体节奏很重要,建议每题不超过 40 分钟,留 10 分钟检查边界情况。
Maximum Profit in Job Scheduling
Easy-Medium
We have I apologize, but there is no text provided in Chinese for me to translate. Please provide the Chinese text you'd like translated. 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 做针对性的 Real-time OA assists None The provided text "。" is a single full stop (period) and does not contain any meaningful content to translate. Therefore, no translation is outputted. If you have a specific Chinese text to translate, please provide it.