Problem database last updated: June 20, 2025

MMastercard logo

Mastercard Coding Interview Questions

12 problems · 5 Easy, 6 Medium, 1 Hard · Ranked #122 of 458

Difficulty breakdown

5 Easy

42% · avg 23%

6 Medium

50% · avg 59%

1 Hard

8% · avg 18%

Top topics

array
66.7%
string
33.3%
dynamic-programming
25%
greedy
25%3x
math
16.7%
two-pointers
16.7%

Interview profile

Based on 12 reported problems, Mastercard interviews are in line with industry averages - 8% Hard vs 18% overall.

Compared to the industry average, Mastercard puts unusual emphasis on greedy (25% of problems, 3x the industry average). If you're short on time, these are the categories to double down on.

The most common topics are array (66.7%), string (33.3%), dynamic-programming (25%), greedy (25%). Problems below are sorted by frequency, the ones at the top are asked most often.

All 12 problems

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

Valid Parentheses

Solve

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

EasyVery Likely
stringstack

Valid Anagram

Solve

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

EasyVery Likely
hash-tablestringsorting

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

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.

MediumVery Likely
arraydynamic-programmingbreadth-first-search

Subsets

Solve

Given an integer array nums of unique elements, return all possible subsets (the power set).

MediumVery Likely
arraybacktrackingbit-manipulation

Gas Station

Solve

There are n gas stations along a circular route, where the amount of gas at the ith station is gas[i].

MediumVery Likely
arraygreedy

Rotate Image

Solve

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

MediumVery Likely
arraymathmatrix

Fizz Buzz

Solve

Given an integer n, return a string array answer (1-indexed) where:

EasyVery Likely
mathstringsimulation

Longest Palindromic Substring

Solve

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

MediumVery Likely
two-pointersstringdynamic-programming

Candy

Solve

There are n children standing in a line. Each child is assigned a rating value given in the integer array ratings.

HardVery Likely
arraygreedy

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

MediumVery Likely
arraytwo-pointersgreedy

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

Very Likely

75-100%

Likely

50-74%

Sometimes

25-49%

Rare

0-24%

Preparing for your Mastercard coding interview

Mastercard interviews focus heavily on array, string, dynamic-programming 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. Mastercard 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 Mastercard ask in interviews?add

Mastercard has been reported to ask 12 distinct coding problems. The most common topics are array, string, dynamic-programming. 5 are Easy difficulty, 6 are Medium, and 1 are Hard. Problems are sorted by frequency - the ones at the top are asked most often.

How hard are Mastercard coding interviews?add

Based on 12 reported problems, Mastercard interviews are in line with industry averages - 8% Hard vs 18% overall. 50% 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 Mastercard coding interview?add

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

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

Simulate a Mastercard interview with AIarrow_forward