Recently helped a trainee brush up on a set of Capital One . The overall question type of the OA is still on the regular logic + programming combination. The time is not particularly tight, but the number of questions is rather miscellaneous, so it is easy to step on the pit in the details. On the surface of the timetable, it is not tight, but in fact, because the number of questions is mixed, it is easy to be slowed down by the details of reading, analyzing, writing code, and adjusting bugs. In particular, such questions as string processing, matrix operations, once the steps are missed, it is possible to give up.
So the biggest feeling I got from this OA is that it's not about "not being able to do it", it's about being able to write it correctly in one go and stepping on fewer potholes that determines whether or not you can pass the exam successfully.
Capital One Online Assessment Sharing of real questions
Question 1: Find the first day reaching target
You are given an array of non-negative integers, which can be used as a reference to the number of integers in the integer. 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→ Output3 - visits =
[600, 700, 800], target =600→ Output0 - visits =
[200, 300, 100], target =1000→ Output-1
👉 Idea: traverse the array to do the prefix sum, the side of the cumulative judgment, encountered to meet the conditions of the first day directly return 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"→ vowel 3, consonant 3 → difference 0"moon"→ vowel 2, consonant 2 → difference 0"base"→ vowel 2, consonant 2 → difference 0
Sorted results:["apollo", "base", "moon"]
👉 Idea: Use set to store vowels and traverse the statistics. Sort by difference first, then by dictionary.
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], [
[40, 50, 60], [70, 80, 90].
[70, 80, 90]
]
commands = ["swapRows 0 1", "swapColumns 0 2", "reverseRow 2", "rotate90Clockwise" ]
result =
[
[70, 40, 10], [80, 50, 20], "swapColumns 0 2", "reverseRow 2", "rotate90Clockwise"]
[80, 50, 20], [90, 60, 30], [90, 60, 30], "rotate90Clockwise"]
[90, 60, 30]
]
👉 Idea: Just simulate the operation. Be careful. rotate90Clockwise The realization of this can be done by transposing + flipping rows.
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"]
Execution process:
- robot → drone →
"drone arm system online" - online → active →
"drone arm system active" - arm → hand →
"drone hand system active"
Final Results:"drone hand system active"
👉 Idea: use the string's replace Methods are handled sequentially.
You don't have to fight alone.
If you're also sprinting for OA/interviews at Capital One or other big North American firms, there's really no need to die alone at all.
Programhelp can give you a full boost in critical moments:
The senior communicate with you directly, resume packaging, interview on behalf of the interview, on behalf of the interview, code writing, Q&A consulting, VO assists, interview assistance, VO assistance, OA writing, OA assistance are personally. Many students have been assisted by us to successfully handle the OA, get through the interview and get the coveted offer.
The way to shore is faster and more stable with your teammates by your side.