最近幫學員刷過一套 Capital One 的 OA,整體題型還是偏常規的邏輯+程式設計組合。 時間不算特別緊,但題量比較雜,容易在細節上踩坑。 時間安排上表面看不緊,但實際上因為題量偏雜,讀題、分析、寫代碼、調 bug 一套下來,很容易被細節拖慢節奏。 尤其是像字串處理、矩陣操作這類題,步驟一旦漏掉,就可能前功盡棄。
所以這套 OA 給我的最大感受就是——不是“做不出來”,而是能不能一次寫對、少踩坑,才是決定能否順利通過的關鍵。
Capital One Online Assessment 真題分享
Question 1: Find the first day reaching target
You are given an array of non-negative integers, visits, where visits[i] is the number of visitors on the i-th day.
Return the first index i such that visits[0] + visits[1] + ... + visits[i] >= target. If the total sum never reaches target, return -1.
Example
- visits =
[120, 350, 180, 400, 250], target =900→ 输出3 - visits =
[600, 700, 800], target =600→ 输出0 - visits =
[200, 300, 100], target =1000→ 输出-1
👉 思路:遍歷陣組做前綴和,邊累加邊判斷,遇到滿足條件的第一天直接返回 index。
Question 2: Sort words by vowel-consonant difference
You are given a string text consisting of unique lowercase English words separated by spaces.
For each word, count the number of vowels (a, e, i, o, u) and consonants, and calculate their absolute difference.
Return the words sorted in ascending order of this absolute difference. If the differences are the same, sort alphabetically.
Example
- text =
"apollo moon base""apollo"→ 元音 3,辅音 3 → 差值 0"moon"→ 元音 2,輔音 2 → 差值 0"base"→ 元音 2,輔音 2 → 差值 0
排序后结果:["apollo", "base", "moon"]
👉 思路:用 set 存元音,遍歷統計即可。 排序時注意 先按差值,再按字典序。
Question 3: Matrix transformation with commands
You are given a 2D list matrix and a list of commands commands. Each command can be one of the following:
"swapRows r1 r2""swapColumns c1 c2""reverseRow r""reverseColumn c""rotate90Clockwise"
Apply the commands in order and return the final state of the matrix.
Example
matrix = [
[10, 20, 30],
[40, 50, 60],
[70, 80, 90]
]
commands = ["swapRows 0 1", "swapColumns 0 2", "reverseRow 2", "rotate90Clockwise"]
result =
[
[70, 40, 10],
[80, 50, 20],
[90, 60, 30]
]
👉 思路:類比操作即可。 要注意 rotate90Clockwise 的實現,可以通過轉置+翻轉行完成。
Question 4: String replacement operations
You are given a string s and a list of operations operations.
Each operation has the form "replace old new", meaning replace all occurrences of old with new.
Apply the operations in order and return the final string.
Example
s = "robot arm system online"
operations = ["replace robot drone", "replace online active", "replace arm hand"]
執行過程:
- robot → drone →
"drone arm system online" - online → active →
"drone arm system active" - arm → hand →
"drone hand system active"
最終結果:"drone hand system active"
👉 思路:用字串的 replace 方法依次處理。
不必孤身奮戰
如果你也在衝刺 Capital One 或其他北美大廠的 OA/面試,其實完全沒必要一個人死磕。
Programhelp 可以在關鍵時刻給你全程助力:
學長與您直接溝通,簡歷包裝,面試代面,代面試,代碼代寫,答疑諮詢,VO 助攻,面試輔助 ,VO 輔助,OA 代寫,OA 輔助都是親力親為。 很多同學就是在我們的助攻下,順利搞定 OA、闖過面試關,拿到了夢寐以求的 offer。
上岸的路上,有隊友在身邊,才走得更快更穩。