Capital One OA 四题一次过|题库重叠+思路超熟悉,全程半小时速通

604閱讀
沒有評論

10 月 8 号刚测完 Capital One OA ,四题一次全过!这次的题库跟 TikTok、Uber 的 codesignal 题几乎完全一致,难度适中、逻辑清晰,半小时左右就能全部 AC。整体体验非常丝滑,题目熟悉度高,细节处理上稍有变化但核心思路不变。

Q1. Bus Missions Between Alpha and Beta

Description:
You have multiple missions. Each mission requires you to travel from Alpha → Beta → Alpha.
There are bus schedules for both directions.
Each time, you must take the earliest bus you can catch based on your current time.
Return the time when all missions are completed.

思路:
就是一个模拟题。每次来回一趟:

  1. 从当前时间找出 Alpha → Beta 的最早班车;
  2. 到达 Beta 后,找 Beta → Alpha 的最早班车;
  3. 重复上述步骤 missions 次,最后输出最终返回时间。

用两个指针分别扫两份时间表即可,细节是要处理“>= 当前时间”的条件。

Q2. Count Substrings with Exactly Two Vowels

Description:
Given a string s, count how many substrings of length 3 contain exactly two vowels (a, e, i, o, u).

思路:
这题很快:

  • 滑动窗口长度为 3;
  • 每次检查其中元音个数是否等于 2;
  • 若满足则计数加一。

复杂度 O(n),实现不到 5 行,非常直接。

Q3. Minimum Height Difference Between Peaks

Description:
You are given an array heights and an integer viewingGap.
Find all pairs (a, b) where |a - b| ≥ viewingGap, and return the minimum absolute difference of their heights.

思路:
暴力也能过:

  • 双层循环,枚举所有满足距离条件的 pair;
  • 计算高度差的绝对值;
  • 更新最小值。

如果输入特别大,也可以考虑双指针或预处理,但一般 brute force 就能 AC。

Q4. Placing Figures on a Grid

Description:
You are given an empty grid of size x × y (initially all zeros) and a list figures of five shapes.
You need to place them sequentially on the grid.
For each figure:

  • Scan from top to bottom, left to right;
  • Find the first position where the figure can fit;
  • Fill those cells with the figure’s index (starting from 1);
  • If it doesn’t fit anywhere, skip it.

思路:
经典模拟+实现题。对每个形状逐格扫描,检查能否放下。
注意边界检查、重叠判断和更新 grid。实现比较繁琐,但逻辑清晰。

OA 总结

这次 Capital One OA 可以说是 “codesignal 热门题精选集”。
四题都偏向模拟与逻辑思考,考查细节实现而非复杂算法。

难度排序大致是:

Q2(简单) < Q3(中等) < Q1(中等偏上) < Q4(实现细节多)

如果你之前刷过 TikTok 或 Uber OA,这套题几乎可以闭眼写。
我这次 27 分钟全过,全部 test case 100%。

一次通过的背后,其实有点“黑科技”

这次能半小时全 AC,说实话,不全靠运气。
这次面试我找到Programhelp进行“无痕联机助攻”,能实时看代码运行、同步节奏、语音提示关键点,但完全不留痕迹。
这对 codesignal、hackerrank 这类环境特别有用——
你只管思路和写法,剩下的调试、边界、test case 都能在后台帮你稳住。
正式测的时候心态稳得离谱。

author avatar
jor jor
正文完
 1