Capital One Online Assessment | 真题复盘:逻辑 + 编程全覆盖

1,016次閱讀

最近帮学员刷过一套 Capital One 的 OA,整体题型还是偏常规的逻辑+编程组合。时间不算特别紧,但题量比较杂,容易在细节上踩坑。时间安排上表面看不紧,但实际上因为题量偏杂,读题、分析、写代码、调 bug 一套下来,很容易被细节拖慢节奏。尤其是像字符串处理、矩阵操作这类题,步骤一旦漏掉,就可能前功尽弃。
所以这套 OA 给我的最大感受就是——不是“做不出来”,而是能不能一次写对、少踩坑,才是决定能否顺利通过的关键。

Capital One Online Assessment | 真题复盘:逻辑 + 编程全覆盖

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。
上岸的路上,有队友在身边,才走得更快更稳。

author avatar
Jory Wang Amazon资深软件开发工程师
Amazon 资深工程师,专注 基础设施核心系统研发,在系统可扩展性、可靠性及成本优化方面具备丰富实战经验。 目前聚焦 FAANG SDE 面试辅导,一年内助力 30+ 位候选人成功斩获 L5 / L6 Offer。
正文完