最近真是 OA 密集轰炸模式,一天排好几场,几乎没停过。昨天刚刚结束一轮 Goldman Sachs online assessment(HackerRank 平台),整体难度不算夸张,20 分钟就稳稳做完了,正好来和大家详细复盘一下,给还在准备的小伙伴一些参考。
这次的题目主要是两道 Coding,虽然不是那种超难 DP/图论,但也有一些细节容易掉坑。分享下思路和注意点。

Problem 1: Minimize Machine Usage
Problem Statement:
You are given a set of machines, each with a certain number of usages. The goal is to bring all usage counts down to zero through a series of operations.
- In one operation, you can select two machines and decrease each of their usage counts by one.
- You need to determine the minimum number of operations required to make all machines reach zero.
Key Insights:
This problem can be efficiently solved with a greedy strategy:
- In every step, pair the machine with the highest usage count with the machine that has the lowest usage count, and reduce both.
- Repeating this ensures that the “heaviest load” is being balanced by the “lightest load,” preventing unnecessary leftover usages.
Special Case Handling:
- If a machine’s usage count becomes very small, it can quickly be reduced to zero without wasting additional operations.
Implementation Details:
- The data size is not very large, so simulation with priority queues is feasible.
- A max heap can be used to always extract the machine with the largest usage count, and a min heap for the smallest one.
- Each operation decreases both selected values, and the total count of operations is accumulated until all values reach zero.
Answer:
The final result is simply the sum of all operations performed.
This greedy pairing guarantees the minimum number of steps.
Problem 2: Pods and Costs Placement
Problem Statement:
You are given a collection of elements, where each element has two attributes:
podcost
The task is to arrange these elements in an array according to the following rules:
- Elements with a higher cost must be placed with higher priority.
- After placing high-cost elements, the lower-cost elements should be assigned to the remaining available positions.
Key Insights:
This is a greedy + data structure problem.
- First, treat each element as a pair
(pod, cost). - Sort all elements in descending order of cost.
- Traverse the sorted list:
- If the position of a high-cost element is available, it should be fixed there.
- For lower-cost elements, if the intended position is already occupied, they must move to the next available free slot.
Optimization:
Naively scanning linearly for the next free position is inefficient. Instead:
- Use a map or disjoint set union (DSU/union-find) to keep track of the “next available position.”
- This allows jumping directly to the nearest empty slot without checking one by one.
Implementation Strategy:
- Sort by cost (descending).
- Insert elements in order, fixing high-cost ones first.
- Maintain the next available slot pointer using DSU or a map for efficient placement of remaining elements.
Takeaway:
The problem combines greedy prioritization (cost ordering) with efficient data structure usage (map/DSU) to handle placement in logarithmic or near-constant time.
Goldman Sachs online assessment 整体难度与感受
说实话,这次 Goldman Sachs OA 算是比较友好的,不像有些公司的 OA 爱考花哨的概率题或者 tricky DP。这里的两道题逻辑都比较直观,难点主要在实现细节。
我用时大概 20 分钟,主要时间花在 debug 边界条件。比如:
Problem 1 里,机器次数为 0 的处理是否及时跳出循环。
Problem 2 里,空位分配如果写得不够严谨,可能会覆盖到已经放好的高 cost 元素。
这类细节一旦没踩稳,很容易浪费十几分钟 debug。
给准备高盛 OA 的小建议
- 刷题方向:贪心、排序、map/heap 这种数据结构类的题要重点复习。
- 节奏把握:Goldman Sachs 的 OA 时间并不算很紧张,但如果在细节上卡住,就会很危险。
- 实战演练:尽量模拟真实环境,定时做题,把“卡点思维”提前练熟。
很多同学其实题目会做,但在实战里容易慌张,比如:
不知道什么时候该果断放弃 brute force。
debug 时陷入死循环,时间就被吃光。
没有规划好写代码的节奏,导致本来 15 分钟能写完的题,拖到 30 分钟还没过样例。
想冲击大厂但时间有限?
别担心,我们能为你提供全方位的支持:
OA 代写 & 笔试包过:HackerRank、牛客网、CodeSignal 等平台全覆盖,专业写手在线代写,保证所有测试用例 100% 通过,不通过不收费,远程无痕操作安全可靠。
面试助攻 & VO 辅助:实时语音提示 + 思路引导,让你在面试中从容应对,北美 CS 专家人工助攻,远超单纯刷题效果。
代面试(全程代面):转接摄像头+变声技术,团队默契配合,提前多轮模拟,帮你轻松化身“无懈可击的候选人”,直通大厂 Offer。
全套护航 & Offer 保拿:从 OA 到技术面,再到签约谈判,全流程一站式服务,预付少量定金,Offer 到手再付尾款,风险极低。
更多支持:模拟面试、面经分享、编程代写、简历优化、算法辅导、Quant 面试辅助,甚至留学生入学代面,我们都能提供专业支持。
如果你也在备战大厂,不要一个人硬扛。找对帮手,少走弯路,拿 Offer 真的可以更快更稳!