Problem database last updated: June 20, 2025

VVisa logo

Visa Coding Interview Questions

80 problems · 21 Easy, 44 Medium, 15 Hard · Ranked #29 of 458

Difficulty breakdown

21 Easy

26% · avg 23%

44 Medium

55% · avg 59%

15 Hard

19% · avg 18%

Top topics

array
65%
string
31.3%
hash-table
25%
dynamic-programming
16.3%
sorting
16.3%
matrix
11.3%

Interview profile

Based on 80 reported problems, Visa interviews are in line with industry averages - 19% Hard vs 18% overall. The majority (55%) 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, Visa puts unusual emphasis on rolling-hash (2.5% of problems, 6.7x the industry average), string-matching (3.8% of problems, 4.3x the industry average), hash-function (2.5% of problems, 4.3x the industry average). If you're short on time, these are the categories to double down on.

The most common topics are array (65%), string (31.3%), hash-table (25%), dynamic-programming (16.3%). Problems below are sorted by frequency, the ones at the top are asked most often.

All 80 problems

Length Of Longest V Shaped Diagonal Segment

Solve

You are given a 2D integer matrix grid of size n x m, where each element is either 0, 1, or 2. A V-shaped diagonal segment starts with 1 and subsequent elements...

HardVery Likely
memoizationarraydynamic-programming

Two Sum

Solve

Given an array of integers nums and an integer target, return the indices of the two numbers that add up to target.

EasyVery Likely
arrayhash-map

Split the Array

Solve

You are given an integer array nums of even length. You have to split the array into two parts nums1 and nums2 such that:

EasyVery Likely
arrayhash-tablecounting

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:

MediumVery Likely
arraytwo-pointersmatrix

3Sum

Solve

Given an integer array nums, return all the triplets [nums[i], nums[j], nums[k]] such that i != j, i != k, and j != k, and nums[i] + nums[j] + nums[k] == 0.

MediumVery Likely
arraytwo-pointerssorting

Create Target Array in the Given Order

Solve

Given two arrays of integers nums and index. Your task is to create target array under the following rules:

EasyVery Likely
arraysimulation

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.

EasyVery Likely
arraydynamic-programming

Maximum Number of Events That Can Be Attended

Solve

You are given an array of events where events[i] = [startDayi, endDayi]. Every event i starts at startDayi and ends at endDayi.

MediumVery Likely
arraygreedysorting

Longest Substring Without Repeating Characters

Solve

Given a string s, find the length of the longest substring without duplicate characters.

MediumVery Likely
hash-tablestringsliding-window

Divisor Game

Solve

Alice and Bob take turns playing a game, with Alice starting first.

EasyVery Likely
mathdynamic-programmingbrainteaser

Earliest Possible Day of Full Bloom

Solve

You have n flower seeds. Every seed must be planted first before it can begin to grow, then bloom. Planting a seed takes time and so does the growth of a seed....

HardVery Likely
arraygreedysorting

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

Odd String Difference

Solve

You are given an array of equal-length strings words. Assume that the length of each string is n.

EasyVery Likely
arrayhash-tablestring

Count Nodes With the Highest Score

Solve

There is a binary tree rooted at 0 consisting of n nodes. The nodes are labeled from 0 to n - 1. You are given a 0-indexed integer array parents representing th...

MediumVery Likely
arraytreedepth-first-search

Group Anagrams

Solve

Given an array of strings strs, group the anagrams together. You can return the answer in any order.

MediumVery Likely
arrayhash-tablestring

Two Furthest Houses With Different Colors

Solve

There are n houses evenly lined up on the street, and each house is beautifully painted. You are given a 0-indexed integer array colors of length n, where color...

EasyVery Likely
arraygreedy

Longest Common Prefix

Solve

Write a function to find the longest common prefix string amongst an array of strings.

EasyVery Likely
arraystringtrie

LRU Cache

Solve

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

MediumVery Likely
hash-tablelinked-listdesign

Valid Parentheses

Solve

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

EasyLikely
stringstack

Search in Rotated Sorted Array

Solve

There is an integer array nums sorted in ascending order (with distinct values).

MediumLikely
arraybinary-search

Trapping Rain Water

Solve

Given n non-negative integers representing an elevation map where the width of each bar is 1, compute how much water it can trap after raining.

HardLikely
arraytwo-pointersdynamic-programming

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...

HardLikely
arraystringsimulation

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

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.

MediumLikely
arraydepth-first-searchbreadth-first-search

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...

MediumLikely
array

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.

MediumLikely
arrayhash-tablematrix

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...

MediumLikely
arraysorting

Longest Palindromic Substring

Solve

Given a string s, return the longest palindromic substring in s.

MediumLikely
two-pointersstringdynamic-programming

Reverse Words in a String

Solve

Given an input string s, reverse the order of the words.

MediumLikely
two-pointersstring

Reverse Linked List

Solve

Given the head of a singly linked list, reverse the list, and return the reversed list.

EasyLikely
linked-listrecursion

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

Maximum Subarray

Solve

Given an integer array nums, find the subarray with the largest sum, and return its sum.

MediumLikely
arraydivide-and-conquerdynamic-programming

Daily Temperatures

Solve

Given an array of integers temperatures represents the daily temperatures, return an array answer such that answer[i] is the number of days you have to wait aft...

MediumLikely
arraystackmonotonic-stack

Course Schedule

Solve

There are a total of numCourses courses you have to take, labeled from 0 to numCourses - 1. You are given an array prerequisites where prerequisites[i] = [ai, b...

MediumLikely
depth-first-searchbreadth-first-searchgraph

Diameter of Binary Tree

Solve

Given the root of a binary tree, return the length of the diameter of the tree.

EasyLikely
treedepth-first-searchbinary-tree

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.

HardLikely
linked-listrecursion

Find Peak Element

Solve

A peak element is an element that is strictly greater than its neighbors.

MediumLikely
arraybinary-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

Restore IP Addresses

Solve

A valid IP address consists of exactly four integers separated by single dots. Each integer is between 0 and 255 (inclusive) and cannot have leading zeros.

MediumLikely
stringbacktracking

Check If Array Pairs Are Divisible by k

Solve

Given an array of integers arr of even length n and an integer k.

MediumLikely
arrayhash-tablecounting

Roman to Integer

Solve

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

EasyLikely
hash-tablemathstring

Rotate String

Solve

Given two strings s and goal, return true if and only if s can become goal after some number of shifts on s.

EasyLikely
stringstring-matching

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

Word Ladder

Solve

A transformation sequence from word beginWord to word endWord using a dictionary wordList is a sequence of words beginWord -> s1 -> s2 -> ... -> sk such that:

HardLikely
hash-tablestringbreadth-first-search

Top K Frequent Elements

Solve

Given an integer array nums and an integer k, return the k most frequent elements. You may return the answer in any order.

MediumLikely
arrayhash-tabledivide-and-conquer

Shortest Palindrome

Solve

You are given a string s. You can convert s to a palindrome by adding characters in front of it.

HardLikely
stringrolling-hashstring-matching

Find Score of an Array After Marking All Elements

Solve

You are given an array nums consisting of positive integers.

MediumSometimes
arrayhash-tablesorting

Palindrome Number

Solve

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

EasySometimes
math

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

Largest Number

Solve

Given a list of non-negative integers nums, arrange them such that they form the largest number and return it.

MediumSometimes
arraystringgreedy

Valid Anagram

Solve

Given two strings s and t, return true if t is an anagram of s, and false otherwise.

EasySometimes
hash-tablestringsorting

Plus One

Solve

You are given a large integer represented as an integer array digits, where each digits[i] is the ith digit of the integer. The digits are ordered from most sig...

EasySometimes
arraymath

Container With Most Water

Solve

You are given an integer array height of length n. There are n vertical lines drawn such that the two endpoints of the ith line are (i, 0) and (i, height[i]).

MediumSometimes
arraytwo-pointersgreedy

Valid Palindrome

Solve

A phrase is a palindrome if, after converting all uppercase letters into lowercase letters and removing all non-alphanumeric characters, it reads the same forwa...

EasySometimes
two-pointersstring

Edit Distance

Solve

Given two strings word1 and word2, return the minimum number of operations required to convert word1 to word2.

MediumSometimes
stringdynamic-programming

Integer to Roman

Solve

Seven different symbols represent Roman numerals with the following values:

MediumSometimes
hash-tablemathstring

Contains Duplicate

Solve

Given an integer array nums, return true if any value appears at least twice in the array, and return false if every element is distinct.

EasySometimes
arrayhash-tablesorting

Search a 2D Matrix

Solve

You are given an m x n integer matrix matrix with the following two properties:

MediumSometimes
arraybinary-searchmatrix

Substrings of Size Three with Distinct Characters

Solve

A string is good if there are no repeated characters.

EasySometimes
hash-tablestringsliding-window

Second Highest Salary

Solve

Table: Employee

MediumSometimes
database

Median of Two Sorted Arrays

Solve

Given two sorted arrays nums1 and nums2 of size m and n respectively, return the median of the two sorted arrays.

HardSometimes
arraybinary-searchdivide-and-conquer

Merge Two Sorted Lists

Solve

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

EasySometimes
linked-listrecursion

Valid Sudoku

Solve

Determine if a 9 x 9 Sudoku board is valid. Only the filled cells need to be validated according to the following rules:

MediumSometimes
arrayhash-tablematrix

K Closest Points to Origin

Solve

Given an array of points where points[i] = [xi, yi] represents a point on the X-Y plane and an integer k, return the k closest points to the origin (0, 0).

MediumSometimes
arraymathdivide-and-conquer

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.

MediumSometimes
arrayrolling-hashstring-matching

Sliding Window Maximum

Solve

You are given an array of integers nums, there is a sliding window of size k which is moving from the very left of the array to the very right. You can only see...

HardSometimes
arrayqueuesliding-window

Best Time to Buy and Sell Stock III

Solve

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

HardSometimes
arraydynamic-programming

House Robber II

Solve

You are a professional robber planning to rob houses along a street. Each house has a certain amount of money stashed. All houses at this place are arranged in...

MediumSometimes
arraydynamic-programming

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

Split Message Based on Limit

Solve

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

HardSometimes
stringenumeration

Find the Length of the Longest Common Prefix

Solve

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

MediumSometimes
arrayhash-tablestring

LFU Cache

Solve

Design and implement a data structure for a Least Frequently Used (LFU) cache.

HardSometimes
hash-tablelinked-listdesign

Binary Tree Cameras

Solve

You are given the root of a binary tree. We install cameras on the tree nodes where each camera at a node can monitor its parent, itself, and its immediate chil...

HardSometimes
dynamic-programmingtreedepth-first-search

Partition Equal Subset Sum

Solve

Given an integer array nums, return true if you can partition the array into two subsets such that the sum of the elements in both subsets is equal or false oth...

MediumSometimes
arraydynamic-programming

Best Time to Buy and Sell Stock with Cooldown

Solve

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

MediumSometimes
arraydynamic-programming

Minimum Time Difference

Solve

Given a list of 24-hour clock time points in "HH:MM" format, return the minimum minutes difference between any two time-points in the list.

MediumSometimes
arraymathstring

Image Smoother

Solve

An image smoother is a filter of the size 3 x 3 that can be applied to each cell of an image by rounding down the average of the cell and the eight surrounding...

EasySometimes
arraymatrix

Number of Matching Subsequences

Solve

Given a string s and an array of strings words, return the number of words[i] that is a subsequence of s.

MediumSometimes
arrayhash-tablestring

Sum Root to Leaf Numbers

Solve

You are given the root of a binary tree containing digits from 0 to 9 only.

MediumSometimes
treedepth-first-searchbinary-tree

Spiral Matrix

Solve

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

MediumSometimes
arraymatrixsimulation

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 Visa interviews.

Very Likely

75-100%

Likely

50-74%

Sometimes

25-49%

Rare

0-24%

Preparing for your Visa coding interview

Visa interviews focus heavily on array, string, hash-table 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. Visa 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 Visa ask in interviews?add

Visa has been reported to ask 80 distinct coding problems. The most common topics are array, string, hash-table. 21 are Easy difficulty, 44 are Medium, and 15 are Hard. Problems are sorted by frequency - the ones at the top are asked most often.

How hard are Visa coding interviews?add

Based on 80 reported problems, Visa interviews are in line with industry averages - 19% Hard vs 18% overall. 55% 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 Visa coding interview?add

Start with the highest-frequency problems listed on this page. Focus on the core topics: array, string, hash-table. 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 Visa interview?

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

Simulate a Visa interview with AIarrow_forward