Capital One OA Interview|2025 Top Questions Review|Coding Ideas + Solution Strategies Sharing

1,048 Views
No Comment

This time, I'm sharing with you what I've learned in Capital One The overall style of the two questions encountered in OA is still typical of the written exams of major North American banking firms: both the solidity of the algorithmic thinking and the precise grasp of the logical conditions are examined. The first question is the maximum square area in an array of skyscrapers, the idea is very similar to the "dichotomous answer + interval verification"; the second question is the statistics of "near-regular crosses" in the matrix, focusing on the distribution of frequency and the understanding of the specificity of the center element. The two questions seem to be independent, but in fact, both require a clean code + efficient solution, otherwise it is easy to get stuck in time.

Question 1: Largest Square Area

Problem.
You are given an array of integers representing the heights of skyscrapers in a row.
Find the maximum area of a square that can be placed among these buildings.

  • A square of side length m can be placed if there exists a contiguous subarray of length m where every building's height is at least m.
  • The output should be the largest possible square area ().

Example 1.

Input: heights = [3, 1, 3, 4, 4, 3, 5]
Output: 9
Explanation.
The maximum square has side length 3 (for example, subarray [3,4,3] or [4,3,5]).
Area = 3 * 3 = 9.

Example 2.

Input: heights = [2, 2, 2]
Output: 4
Explanation.
The maximum square has side length 2 (subarray [2,2]).
Area = 2 * 2 = 4.

Question 2: Count of Nearly-Regular Crosses

Problem.
You are given a 2D integer matrix. A "nearly-regular cross" is defined as follows.

  • A cross is formed by choosing a cell as the center, taking its row as the horizontal arm and its column as the vertical arm.
  • Collect all numbers appearing in that row and column.
  • If all numbers are identical, it is a regular cross (valid).
  • If there are exactly two distinct numbers and one of them appears only once, and that unique element is the center cell, then it is a nearly-regular cross (also valid).
  • Otherwise, it is not valid.

Return the total number of valid (regular + nearly-regular) crosses in the matrix.

Example 1.

Input.
matrix = [
  [1, 1, 1], [1, 2, 1], [
  
  [1, 1, 1]
]

Output: 1
Explanation.
Only the center cell (value 2 at position [1,1]) forms a nearly-regular cross.
All rows/columns contain only 1s except the center element = 2, so it is valid.

Example 2.

Input.
matrix = [
  
  [5, 5, 5], [5, 5, 5], [5, 5, 5], [5, 5, 5].
  [5, 5, 5]
]

Output: 9
Explanation.
Every cell can be chosen as the center, and all of them form a regular cross.
Total = 9.

If you're also preparing for an OA/VO like Capital One, Citadel, or Amazon, you don't really have to go it alone at all.Programhelp It can provide you with untraceable remote online assists: such as real-time voice reminders, debug ideas pointing, code structure optimization, so that you can make less detours in the stressful exam environment, and put your energy on thinking instead of getting stuck. Many students feedback that with timely reminders, they can output high-quality answers stably and greatly improve the passing rate.

author avatar
jor jor
END
 0
Comment(No Comment)