Problem database last updated: June 20, 2025

CCapital One logo

Capital One Coding Interview Questions

44 problems · 9 Easy, 25 Medium, 10 Hard · Ranked #48 of 458

Difficulty breakdown

9 Easy

20% · avg 23%

25 Medium

57% · avg 59%

10 Hard

23% · avg 18%

Top topics

array
72.7%
string
27.3%
math
22.7%1.8x
hash-table
18.2%
matrix
18.2%2.1x
simulation
13.6%3.2x

Interview profile

Based on 44 reported problems, Capital One interviews are slightly harder than average - 23% Hard vs 18% across all companies. The majority (57%) of questions are Medium difficulty, which is typical for companies that want to see solid fundamentals without excessive trick questions.

Compared to the industry average, Capital One puts unusual emphasis on rolling-hash (6.8% of problems, 18.2x the industry average), hash-function (6.8% of problems, 11.7x the industry average), ordered-set (9.1% of problems, 9x the industry average). If you're short on time, these are the categories to double down on.

The most common topics are array (72.7%), string (27.3%), math (22.7%), hash-table (18.2%). Problems below are sorted by frequency, the ones at the top are asked most often.

All 44 problems

Simple Bank System

Solve

You have been tasked with writing a program for a popular bank that will automate all its incoming transactions (transfer, deposit, and withdraw). The bank has...

MediumVery Likely
arrayhash-tabledesign

Spiral Matrix

Solve

Given an m x n matrix, return all elements of the matrix in spiral order.

MediumVery Likely
arraymatrixsimulation

Block Placement Queries

Solve

There exists an infinite number line, with its origin at 0 and extending towards the positive x-axis.

HardVery Likely
arraybinary-searchbinary-indexed-tree

Text Justification

Solve

Given an array of strings words and a width maxWidth, format the text such that each line has exactly maxWidth characters and is fully (left and right) justifie...

HardVery Likely
arraystringsimulation

Minimum Operations to Write the Letter Y on a Grid

Solve

You are given a 0-indexed n x n grid where n is odd, and grid[r][c] is 0, 1, or 2.

MediumVery Likely
arrayhash-tablematrix

Count Alternating Subarrays

Solve

You are given a binary array nums.

MediumVery Likely
arraymath

Rotate Image

Solve

You are given an n x n 2D matrix representing an image, rotate the image by 90 degrees (clockwise).

MediumLikely
arraymathmatrix

Four Divisors

Solve

Given an integer array nums, return the sum of divisors of the integers in that array that have exactly four divisors. If there is no such integer in the array,...

MediumLikely
arraymath

Count Operations to Obtain Zero

Solve

You are given two non-negative integers num1 and num2.

EasyLikely
mathsimulation

Simplify Path

Solve

You are given an absolute path for a Unix-style file system, which always begins with a slash '/'. Your task is to transform this absolute path into its simplif...

MediumLikely
stringstack

Longest Continuous Subarray With Absolute Diff Less Than or Equal to Limit

Solve

Given an array of integers nums and an integer limit, return the size of the longest non-empty subarray such that the absolute difference between any two elemen...

MediumLikely
arrayqueuesliding-window

Split Message Based on Limit

Solve

You are given a string, message, and a positive integer, limit.

HardLikely
stringenumeration

Rotating the Box

Solve

You are given an m x n matrix of characters boxGrid representing a side-view of a box. Each cell of the box is one of the following:

MediumLikely
arraytwo-pointersmatrix

Number of Black Blocks

Solve

You are given two integers m and n representing the dimensions of a 0-indexed m x n grid.

MediumLikely
arrayhash-tableenumeration

Largest Rectangle in Histogram

Solve

Given an array of integers heights representing the histogram's bar height where the width of each bar is 1, return the area of the largest rectangle in the his...

HardLikely
arraystackmonotonic-stack

Count Prefix and Suffix Pairs II

Solve

You are given a 0-indexed string array words.

HardLikely
arraystringtrie

Best Time to Buy and Sell Stock

Solve

You are given an array prices where prices[i] is the price of a given stock on the ith day.

EasyLikely
arraydynamic-programming

Number of Flowers in Full Bloom

Solve

You are given a 0-indexed 2D integer array flowers, where flowers[i] = [starti, endi] means the ith flower will be in full bloom from starti to endi (inclusive)...

HardLikely
arrayhash-tablebinary-search

Find the Length of the Longest Common Prefix

Solve

You are given two arrays with positive integers arr1 and arr2.

MediumLikely
arrayhash-tablestring

Remove Boxes

Solve

You are given several boxes with different colors represented by different positive numbers.

HardLikely
arraydynamic-programmingmemoization

Coin Change

Solve

You are given an integer array coins representing coins of different denominations and an integer amount representing a total amount of money.

MediumLikely
arraydynamic-programmingbreadth-first-search

Word Search

Solve

Given an m x n grid of characters board and a string word, return true if word exists in the grid.

MediumLikely
arraystringbacktracking

Number of Subarrays That Match a Pattern I

Solve

You are given a 0-indexed integer array nums of size n, and a 0-indexed integer array pattern of size m consisting of integers -1, 0, and 1.

MediumLikely
arrayrolling-hashstring-matching

Palindrome Number

Solve

Given an integer x, return true if x is a palindrome, and false otherwise.

EasyLikely
math

Add Strings

Solve

Given two non-negative integers, num1 and num2 represented as string, return the sum of num1 and num2 as a string.

EasySometimes
mathstringsimulation

Number of Islands

Solve

Given an m x n 2D binary grid grid which represents a map of '1's (land) and '0's (water), return the number of islands.

MediumSometimes
arraydepth-first-searchbreadth-first-search

Non-overlapping Intervals

Solve

Given an array of intervals intervals where intervals[i] = [starti, endi], return the minimum number of intervals you need to remove to make the rest of the int...

MediumSometimes
arraydynamic-programminggreedy

Add Two Numbers

Solve

You are given two non-empty linked lists representing two non-negative integers. The digits are stored in reverse order, and each of their nodes contains a sing...

MediumSometimes
linked-listmathrecursion

Merge Intervals

Solve

Given an array of intervals where intervals[i] = [starti, endi], merge all overlapping intervals, and return an array of the non-overlapping intervals that cove...

MediumSometimes
arraysorting

Binary Tree Paths

Solve

Given the root of a binary tree, return all root-to-leaf paths in any order.

EasySometimes
stringbacktrackingtree

Word Search II

Solve

Given an m x n board of characters and a list of strings words, return all words on the board.

HardSometimes
arraystringbacktracking

Get Biggest Three Rhombus Sums in a Grid

Solve

You are given an m x n integer matrix grid​​​.

MediumSometimes
arraymathsorting

Find Servers That Handled Most Number of Requests

Solve

You have k servers numbered from 0 to k-1 that are being used to handle multiple requests simultaneously. Each server has infinite computational capacity but ca...

HardSometimes
arrayheap-priority-queuesimulation

Rotate Array

Solve

Given an integer array nums, rotate the array to the right by k steps, where k is non-negative.

MediumSometimes
arraymathtwo-pointers

Valid Parentheses

Solve

Given a string s containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input string is valid.

EasySometimes
stringstack

Minimum Absolute Difference Between Elements With Constraint

Solve

You are given a 0-indexed integer array nums and an integer x.

MediumSometimes
arraybinary-searchordered-set

Merge Two Sorted Lists

Solve

You are given the heads of two sorted linked lists list1 and list2.

EasySometimes
linked-listrecursion

Roman to Integer

Solve

Roman numerals are represented by seven different symbols: I, V, X, L, C, D and M.

EasySometimes
hash-tablemathstring

LRU Cache

Solve

Design a data structure that follows the constraints of a Least Recently Used (LRU) cache.

MediumSometimes
hash-tablelinked-listdesign

Count Prefix and Suffix Pairs I

Solve

You are given a 0-indexed string array words.

EasySometimes
arraystringtrie

Best Time to Buy and Sell Stock II

Solve

You are given an integer array prices where prices[i] is the price of a given stock on the ith day.

MediumSometimes
arraydynamic-programminggreedy

Reverse Nodes in k-Group

Solve

Given the head of a linked list, reverse the nodes of the list k at a time, and return the modified list.

HardSometimes
linked-listrecursion

K-diff Pairs in an Array

Solve

Given an array of integers nums and an integer k, return the number of unique k-diff pairs in the array.

MediumSometimes
arrayhash-tabletwo-pointers

Number of Adjacent Elements With the Same Color

Solve

You are given an integer n representing an array colors of length n where all elements are set to 0's meaning uncolored. You are also given a 2D integer array q...

MediumSometimes
array

How often are these problems asked?

Frequency scores are based on crowdsourced interview reports. A higher score means the problem has been reported more often in recent Capital One interviews.

Very Likely

75-100%

Likely

50-74%

Sometimes

25-49%

Rare

0-24%

Preparing for your Capital One coding interview

Capital One interviews focus heavily on array, string, math problems. If you're short on time, these are the categories to prioritize. The problems on this page are sorted by frequency, so start from the top and work your way down.

Beyond solving problems, practice explaining your approach. Capital One interviewers care about your thought process - how you break down a problem, consider edge cases, and evaluate tradeoffs between solutions. A clean O(n) solution you can explain clearly beats an O(log n) solution you can't articulate.

Looking for more companies? Browse all 458 companies in our directory, or sharpen your fundamentals with our free data structure visualizers and AI-powered DSA tutor.

Frequently Asked Questions

What coding problems does Capital One ask in interviews?add

Capital One has been reported to ask 44 distinct coding problems. The most common topics are array, string, math. 9 are Easy difficulty, 25 are Medium, and 10 are Hard. Problems are sorted by frequency - the ones at the top are asked most often.

How hard are Capital One coding interviews?add

Based on 44 reported problems, Capital One interviews are slightly harder than average - 23% Hard vs 18% across all companies. 57% of questions are Medium difficulty. Focus on the high-frequency Medium problems first, then work through the Hard ones.

How should I prepare for a Capital One coding interview?add

Start with the highest-frequency problems listed on this page. Focus on the core topics: array, string, math. Practice solving them under time pressure and explaining your approach out loud. Mock interviews with AI can simulate the real experience.

Other companies to explore

Ready to ace your Capital One interview?

Simulate a real Capital One coding interview with an AI interviewer. Get a scorecard with specific feedback on your problem-solving, code quality, and communication.

Simulate a Capital One interview with AIarrow_forward