2025 Microsoft Online Assessment 學員實戰復盤

994Views

今天上午剛陪一位學員完成了 Microsoft SDE OA,兩題一次過,全程 20 分鐘不到,做完后他整個人都鬆了口氣。
他說:「幸好你們在旁邊幫我盯著邊界條件,不然第一個題二分法我肯定要卡半天。 “這篇文章來還原一下他的實戰過程。 希望對備戰的同學有所説明。

2025 Microsoft Online Assessment 學員實戰復盤

Microsoft Online Assessment 整體流程

Microsoft 的 OA 一般通過 Codility / HackerRank / CodinGame 平臺完成,整體流程如下:

1️⃣ 投遞成功后約 1~3 周內 收到 OA 邀請
2️⃣ 完成測試(約 90 分鐘)
3️⃣ 結果在 1~2 周內出,高分者会收到 HR 的 VO 面试邀约

🔹 总体形式为:

  • 2~3 道程式設計題(演算法類)
  • 1 段行為題視頻回答(行為的)

Q1. Monotonic Array Purchase Queries

Problem (English version):
You are given a non-decreasing array prices[]. There are multiple queries, each query gives:

  • a starting index l
  • a budget x

For each query, you can only buy a contiguous segment starting from l. Find the maximum number of items you can purchase without exceeding the budget.

Key Idea:

  • Precompute prefix sums.
  • For each query, binary search the farthest position r such that prefix[r] - prefix[l-1] <= x.
  • Answer is r - l + 1 (if valid).
prefix[0] = 0
for i in [1..n]:
    prefix[i] = prefix[i-1] + prices[i]

for each query(l, x):
    // binary search for max r
    left = l, right = n, ans = l-1
    while left <= right:
        mid = (left + right) / 2
        if prefix[mid] - prefix[l-1] <= x:
            ans = mid
            left = mid + 1
        else:
            right = mid - 1
    result = max(0, ans - l + 1)

學員過程:
他一開始想重新從 l 开始算局部前缀和,被我们语音提醒说 全局 prefix sum 足够,只要做差即可。
另外,二分法的邊界 ans - l + 1 容易寫錯,我們在關鍵時刻提示了一下,避免了 off-by-one 錯誤。
✅ 最終代碼一次跑通。

Q2. Token System Simulation

Problem (English version):
Implement a system that supports three operations:

  1. generate(token, expiryTime) → create a new token with expiration time.
  2. renew(token, newExpiry) → update the token’s expiration time.
  3. count(currentTime) → return the number of tokens not expired at currentTime.

Key Idea:

  • Use a hash map to store the latest expiry time of each token.
  • Use a min-heap / priority queue to store (expiry, token) for cleanup.
  • Lazy deletion: when querying, remove heap top if it’s expired OR outdated compared to the hash map.
map expiryMap
priority_queue<pair, vector, greater> pq

generate(token, t):
    expiryMap[token] = t
    pq.push({t, token})

renew(token, t):
    if token exists:
        expiryMap[token] = t
        pq.push({t, token})

count(currentTime):
    while !pq.empty() and (pq.top().expiry <= currentTime
           or pq.top().expiry != expiryMap[pq.top().token]):
        pq.pop()
    return expiryMap.size()

學員過程:
他一開始想用 set 去維護所有 token,但在 update 操作上寫不下去。
我們提醒:

  • map 來存最新過期時間。
  • 優先佇列 輔助做清理,採用「延遲刪除」。

他瞬間就懂了,寫完樣例一跑就過了。
✅ 關鍵點在於“lazy cleanup”,我們在語音裡給了提示。

Microsoft OA 體驗分享

這次的 OA 平台沒有攝像頭,環境很寬鬆。 學員自己寫代碼,我們全程無痕連線,幫他把握思路和細節。 整個流程很順,20 分鐘交卷,兩題 AC。

考后总结

微軟的 OA 難度整體不算高,但非常喜歡考察一些「常見模版題 + 容易出錯的細節」:

  • Prefix Sum + Binary Search:邏輯簡單,但容易卡在二分邊界,少寫/多寫一位就掛。
  • Priority Queue + Hash Map 模擬:典型的「延遲刪除」套路,如果沒見過就會亂套。

真正的挑戰不在題本身,而在 時間壓力下能不能一次寫對。
很多同學在準備時只關注題解思路,但在實戰中卻往往因為:

  • 二分條件寫錯
  • 堆和 map 同步出 bug
  • 忘記考慮邊界/空陣列情況

而被卡住,浪費了大量時間。

這次學員的體驗也證明瞭:
只要對高頻題型有準備,再加上有人在關鍵點提醒一下,就能把“可能需要 debug 半小時”的坑,直接縮短到 1 分鐘內解決。

所以总结一句:
微軟 OA 並不刁鑽,但絕對是「細節決定成敗」的考試。 提前練熟常見套路 + 避免現場走神,就是拿下的關鍵。

帶你搞定大廠 Offer

這次幫學員搞定微軟 OA,過程里也再次印證了一個事實:大廠筆試從來不是“會做就行”,而是“會快 + 會穩 + 能避免踩坑”。
很多同學平時題目刷得不少,但真上場容易被時間壓得心態崩掉,或者被一些小細節卡住半天。

我們 programhelp 的遠端助攻就正好解決了這些痛點:

  • 无痕面试辅助:面试时候实时进行文字辅助,保证不会出现“突然懵住”的情况;
  • 語音提醒:面试时候实时语音辅助,比如二分的边界条件、数据清洗的小陷阱,我们会及时提示,避免后续 debug 浪费时间;
  • 全鏈路支援:从 OA 到 VO,再到最终 onsite,我们都有不同的方案,帮你实战稳住节奏。

如果你也在準備微軟(Microsoft)或者其他大廠的 OA/面試,不用再一個人硬扛。
有了辅助 + 语音 + 技术兜底,你会发现准备和考试都轻松很多。

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