剛帶學員順利拿了 Meta OA 四題全 AC!這次題量就是四題,整體難度中等偏上,主要考察邏輯、陣列與各種模擬處理,沒有複雜的演算法,細節卻是非常多的部分。 Meta 本身就很注重程式碼的嚴謹性和思路的清晰度,看似簡單的字串題或循環題,邊界和某些狀態的判斷就會出錯。學員用 Python 完成,文法簡潔容錯率高。整體體驗是——不難,但必須“細”,想拿高分就得寫得乾淨利落。下面整理了完整的題目與我的部分思路供參考。

Meta OA 面試概覽
OA 通常是 4 題程式設計題,自動評分系統,simulation、string、math、greedy 這些題型會比較常見。
語言不限(Python/C++/Java 都可以),Python 在上述所有操作上都有明顯優勢。
完成 OA 後會進入一輪或多輪 VO(視訊面),題型可能延續 OA,解釋思路會成為重點。
目前國內外小廠到大廠(Meta, Amazon, TikTok 等)都在同步發 OA,趁熱打鐵做一次是值得的。
真題回顧(我記憶中的)
Question 1: Count Key Changes
Description:
Given a list of characters representing keys pressed on a keyboard, count the total number of key changes.
If consecutive keys are the same, they don’t count as a change.
A change happens only when the current key is different from the previous one.
Example:
Input: ['a', 'a', 'b', 'b', 'a']
Output: 3
Idea:
Just iterate through the list, compare each character with the previous one, and increment the counter when different.
This is a pure simulation problem, O(n) time.
Question 2: Dominant Single Digit in IP Address
Description:
Given an IP address string like "192.168.1.1", split it by "." into four integers.
For each integer, repeatedly sum its digits until it becomes a single digit.
Then, among these four final digits, find which digit appears most frequently and return it.
Example:
Input: "192.168.1.1"
Processing: [1+9+2=12 → 1+2=3], [1+6+8=15 → 1+5=6], [1], [1]
Final digits: [3,6,1,1]
Output: 1
Idea:
Digit root trick — repeatedly take digit sum or use formula n % 9 (except 0 → 9).
Then use Counter to get the most frequent one.
Question 3: Battery Usage Simulation
Description:
You need to use a phone for t minutes.
There are several batteries; battery i can last capacity[i] minutes,
then needs recharge[i] minutes to recharge (during which it’s unavailable).
You always use the next available battery in order; skip any currently charging.
If all batteries are charging at some point, return -1.
Otherwise, return the number of fully used batteries (each full discharge counts once).
Example:
Input: t = 10, capacity = [5,3], recharge = [4,5]
Output: 3
Explanation:
Use battery0(5min), battery1(3min), battery0(2min) -> total 10min, full discharges=3
Idea:
模擬循環使用,用一個陣列追蹤每個電池下一次可用時間。
每用完一顆電池就更新它的 next_available_time = current_time + recharge[i]。
時間推進直到達到 t 分鐘或所有電池都在充電。
Question 4: Minimum Increments to Make Array ±1 Sequence
Description:
Given an integer array, you can only increase elements (not decrease).
You need to make the array either:
- strictly increasing with difference 1 between neighbors, or
- strictly decreasing with difference 1 between neighbors.
Return the minimum total increment operations needed.
Each increment (+1) counts as one operation.
Example:
Input: [3, 2, 4]
Option1 → Increasing: [3,4,5], cost= (0+2+1)=3
Option2 → Decreasing: [5,4,3], cost=(2+2+0)=4
Output: 3
Idea:
分別以「遞增」 與「遞減」 為目標,模擬兩種情況。
對每個元素計算目標值並取差的累加最小值。
總結
這次 Meta OA 難度不算高,但題目非常“細”,容易因為 off-by-one 或充電邏輯卡分。
重點是寫得穩、覆蓋 edge cases。
如果你之後還要衝 Meta VO / Amazon LP / TikTok Tech Interview,這些都是共題型。
FAQ | Meta OA 常見問題總結
Q1:Meta OA 一共有幾題?難度怎麼樣?
A:通常是 4 道題,題型多為字串處理、模擬、陣列邏輯類,偏基礎但容易在細節上丟分。整體難度中等,比起 LeetCode Hard 更像 Medium 偏上。
Q2:可以用 Python 嗎?評分會有差異嗎?
A:完全可以。 Meta 的自動判題系統支援 Python / Java / C++ 等語言,語言間不會有分差。
不過 Python 在字串、列表、雜湊計數上更省時間,適合快速 AC。
Q3:每題是否有時間限制?提交格式是什麼?
A:通常整場 OA 限時 70-90 分鐘,四題一次性提交。
提交時只需輸出回傳值,不需要 print 過程。測試用例覆蓋範圍很全,要特別注意 edge cases。
Q4:OA 全部 AC 就一定能进 VO 吗?
A:大機率能。 Meta 會根據 OA 成績篩選進入下一輪 VO(Virtual Onsite),不過也會參考履歷匹配度和職位需求。
一般全 AC + 履歷表匹配度高的情況,很快就會收到 VO 邀請。
Q5:VO 面試會考 OA 裡的題嗎?
A:會有延伸。 VO 會基於 OA 的題型(字串處理/ 模擬邏輯)考 deeper reasoning,例如「如果擴展到更大規模怎麼辦」「能否優化複雜度」等。
有時也會混入 behavioral questions(如 team conflict / ownership)。
想拿下 OA+VO?我們能幫你一站到底
Programhelp 已经帮上百位同学在 Meta、Amazon、Google、Shopee 等拿到 offer。
我們提供:
- 实时远程联机助攻(语音提醒 + 快速debug)
- 个性化模拟题强化(还原真实OA环境)
- VO一对一陪练与思路讲解
目前国内外大厂秋招仍在进行中,有OA/VO可直接找我们PM获取助攻位,
Python / C++ / Java 全支持,难题不过我们直接带飞。