Problem database last updated: June 20, 2025

PPhonePe logo

PhonePe Coding Interview Questions

89 problems · 2 Easy, 57 Medium, 30 Hard · Ranked #24 of 458

Difficulty breakdown

2 Easy

2% · avg 23%

57 Medium

64% · avg 59%

30 Hard

34% · avg 18%

Top topics

array
71.9%
dynamic-programming
31.5%1.6x
hash-table
23.6%
sorting
23.6%1.6x
string
18%
greedy
15.7%1.9x

Interview profile

Based on 89 reported problems, PhonePe interviews are significantly harder than average - 34% Hard vs 18% across all companies. The majority (64%) 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, PhonePe puts unusual emphasis on bitmask (3.4% of problems, 6.2x the industry average), shortest-path (2.2% of problems, 4.5x the industry average), topological-sort (4.5% of problems, 3.8x the industry average). If you're short on time, these are the categories to double down on.

The most common topics are array (71.9%), dynamic-programming (31.5%), hash-table (23.6%), sorting (23.6%). Problems below are sorted by frequency, the ones at the top are asked most often.

All 89 problems

Frog Jump

Solve

A frog is crossing a river. The river is divided into some number of units, and at each unit, there may or may not exist a stone. The frog can jump on a stone,...

HardVery Likely
arraydynamic-programming

Burst Balloons

Solve

You are given n balloons, indexed from 0 to n - 1. Each balloon is painted with a number on it represented by an array nums. You are asked to burst all the ball...

HardVery Likely
arraydynamic-programming

Decoded String at Index

Solve

You are given an encoded string s. To decode the string to a tape, the encoded string is read one character at a time and the following steps are taken:

MediumVery Likely
stringstack

Smallest Range Covering Elements from K Lists

Solve

You have k lists of sorted integers in non-decreasing order. Find the smallest range that includes at least one number from each of the k lists.

HardVery Likely
arrayhash-tablegreedy

Maximum Tastiness of Candy Basket

Solve

You are given an array of positive integers price where price[i] denotes the price of the ith candy and a positive integer k.

MediumVery Likely
arraybinary-searchgreedy

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

Frequencies Of Shortest Supersequences

Solve

You are given an array of strings words where each word has length 2. Find all shortest common supersequences (SCS) of words that are not permutations of each o...

HardVery Likely
bit-manipulationgraphtopological-sort

Find Beautiful Indices in the Given Array II

Solve

You are given a 0-indexed string s, a string a, a string b, and an integer k.

HardVery Likely
two-pointersstringbinary-search

Count The Number Of Arrays With K Matching Adjacent Elements

Solve

Given three integers n, m, and k, a good array of size n is one where each element is in the inclusive range [1, m] and exactly k indices i (where 1 <= i < n) s...

HardVery Likely
mathcombinatorics

Check if Point Is Reachable

Solve

There exists an infinitely large grid. You are currently at point (1, 1), and you need to reach the point (targetX, targetY) using a finite number of steps.

HardVery Likely
mathnumber-theory

Maximum Amount Of Money Robot Can Earn

Solve

You are given an m x n grid where a robot starts at the top-left corner (0, 0) and wants to reach the bottom-right corner (m-1, n-1), moving only right or down....

MediumVery Likely
arraydynamic-programmingmatrix

Smallest String With Swaps

Solve

You are given a string s, and an array of pairs of indices in the string pairs where pairs[i] = [a, b] indicates 2 indices(0-indexed) of the string.

MediumVery Likely
arrayhash-tablestring

Remove K Digits

Solve

Given string num representing a non-negative integer num, and an integer k, return the smallest possible integer after removing k digits from num.

MediumVery Likely
stringstackgreedy

Bus Routes

Solve

You are given an array routes representing bus routes where routes[i] is a bus route that the ith bus repeats forever.

HardVery Likely
arrayhash-tablebreadth-first-search

Most Stones Removed with Same Row or Column

Solve

On a 2D plane, we place n stones at some integer coordinate points. Each coordinate point may have at most one stone.

MediumVery Likely
hash-tabledepth-first-searchunion-find

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

Longest Palindromic Substring

Solve

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

MediumLikely
two-pointersstringdynamic-programming

House Robber

Solve

You are a professional robber planning to rob houses along a street. Each house has a certain amount of money stashed, the only constraint stopping you from rob...

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

MediumLikely
arraydynamic-programming

Split Array Largest Sum

Solve

Given an integer array nums and an integer k, split nums into k non-empty subarrays such that the largest sum of any subarray is minimized.

HardLikely
arraybinary-searchdynamic-programming

Candy

Solve

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

HardLikely
arraygreedy

Queue Reconstruction by Height

Solve

You are given an array of people, people, which are the attributes of some people in a queue (not necessarily in order). Each people[i] = [hi, ki] represents th...

MediumLikely
arraybinary-indexed-treesegment-tree

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

Kth Smallest Element in a Sorted Matrix

Solve

Given an n x n matrix where each of the rows and columns is sorted in ascending order, return the kth smallest element in the matrix.

MediumLikely
arraybinary-searchsorting

Maximum Profit in Job Scheduling

Solve

We have n jobs, where every job is scheduled to be done from startTime[i] to endTime[i], obtaining a profit of profit[i].

HardLikely
arraybinary-searchdynamic-programming

Frequency of the Most Frequent Element

Solve

The frequency of an element is the number of times it occurs in an array.

MediumLikely
arraybinary-searchgreedy

Amount of Time for Binary Tree to Be Infected

Solve

You are given the root of a binary tree with unique values, and an integer start. At minute 0, an infection starts from the node with value start.

MediumLikely
hash-tabletreedepth-first-search

Jump Game II

Solve

You are given a 0-indexed array of integers nums of length n. You are initially positioned at index 0.

MediumLikely
arraydynamic-programminggreedy

Suppose LeetCode will start its IPO soon. In order to sell a good price of its shares to Venture Capital, LeetCode would like to work on some projects to increa...

HardLikely
arraygreedysorting

Koko Eating Bananas

Solve

Koko loves to eat bananas. There are n piles of bananas, the ith pile has piles[i] bananas. The guards have gone and will come back in h hours.

MediumLikely
arraybinary-search

Sum of Distances in Tree

Solve

There is an undirected connected tree with n nodes labeled from 0 to n - 1 and n - 1 edges.

HardLikely
dynamic-programmingtreedepth-first-search

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

Make Lexicographically Smallest Array by Swapping Elements

Solve

You are given a 0-indexed array of positive integers nums and a positive integer limit.

MediumLikely
arrayunion-findsorting

Reachable Nodes In Subdivided Graph

Solve

You are given an undirected graph (the "original graph") with n nodes labeled from 0 to n - 1. You decide to subdivide each edge in the graph into a chain of no...

HardLikely
graphheap-priority-queueshortest-path

Accounts Merge

Solve

Given a list of accounts where each element accounts[i] is a list of strings, where the first element accounts[i][0] is a name, and the rest of the elements are...

MediumLikely
arrayhash-tablestring

Sort Colors

Solve

Given an array nums with n objects colored red, white, or blue, sort them in-place so that objects of the same color are adjacent, with the colors in the order...

MediumLikely
arraytwo-pointerssorting

Maximal Square

Solve

Given an m x n binary matrix filled with 0's and 1's, find the largest square containing only 1's and return its area.

MediumLikely
arraydynamic-programmingmatrix

Rotting Oranges

Solve

You are given an m x n grid where each cell can have one of three values:

MediumLikely
arraybreadth-first-searchmatrix

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

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

HardLikely
arraydynamic-programming

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

Swim in Rising Water

Solve

You are given an n x n integer matrix grid where each value grid[i][j] represents the elevation at that point (i, j).

HardLikely
arraybinary-searchdepth-first-search

Minimum Cost to Cut a Stick

Solve

Given a wooden stick of length n units. The stick is labelled from 0 to n. For example, a stick of length 6 is labelled as follows:

HardLikely
arraydynamic-programmingsorting

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

House Robber III

Solve

The thief has found himself a new place for his thievery again. There is only one entrance to this area, called root.

MediumLikely
dynamic-programmingtreedepth-first-search

Distribute Coins in Binary Tree

Solve

You are given the root of a binary tree with n nodes where each node in the tree has node.val coins. There are n coins in total throughout the whole tree.

MediumLikely
treedepth-first-searchbinary-tree

Split Array into Consecutive Subsequences

Solve

You are given an integer array nums that is sorted in non-decreasing order.

MediumLikely
arrayhash-tablegreedy

Matchsticks to Square

Solve

You are given an integer array matchsticks where matchsticks[i] is the length of the ith matchstick. You want to use all the matchsticks to make one square. You...

MediumLikely
arraydynamic-programmingbacktracking

LRU Cache

Solve

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

MediumSometimes
hash-tablelinked-listdesign

Maximum Total Damage With Spell Casting

Solve

A magician has various spells.

MediumSometimes
arrayhash-tabletwo-pointers

Minimum Height Trees

Solve

A tree is an undirected graph in which any two vertices are connected by exactly one path. In other words, any connected graph without simple cycles is a tree.

MediumSometimes
depth-first-searchbreadth-first-searchgraph

Maximum Performance of a Team

Solve

You are given two integers n and k and two integer arrays speed and efficiency both of length n. There are n engineers numbered from 1 to n. speed[i] and effici...

HardSometimes
arraygreedysorting

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

Make Sum Divisible by P

Solve

Given an array of positive integers nums, remove the smallest subarray (possibly empty) such that the sum of the remaining elements is divisible by p. It is not...

MediumSometimes
arrayhash-tableprefix-sum

Best Time to Buy and Sell Stock IV

Solve

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

HardSometimes
arraydynamic-programming

Snakes and Ladders

Solve

You are given an n x n integer matrix board where the cells are labeled from 1 to n2 in a Boustrophedon style starting from the bottom left of the board (i.e. b...

MediumSometimes
arraybreadth-first-searchmatrix

Apply Operations to Maximize Frequency Score

Solve

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

HardSometimes
arraybinary-searchsliding-window

Copy List with Random Pointer

Solve

A linked list of length n is given such that each node contains an additional random pointer, which could point to any node in the list, or null.

MediumSometimes
hash-tablelinked-list

Ways to Make a Fair Array

Solve

You are given an integer array nums. You can choose exactly one index (0-indexed) and remove the element. Notice that the index of the elements may change after...

MediumSometimes
arrayprefix-sum

Course Schedule II

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

MediumSometimes
depth-first-searchbreadth-first-searchgraph

Heaters

Solve

Winter is coming! During the contest, your first job is to design a standard heater with a fixed warm radius to warm all the houses.

MediumSometimes
arraytwo-pointersbinary-search

Walking Robot Simulation

Solve

A robot on an infinite XY-plane starts at point (0, 0) facing north. The robot receives an array of integers commands, which represents a sequence of moves that...

MediumSometimes
arrayhash-tablesimulation

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

Find Duplicate Subtrees

Solve

Given the root of a binary tree, return all duplicate subtrees.

MediumSometimes
hash-tabletreedepth-first-search

Find Minimum Time to Finish All Jobs

Solve

You are given an integer array jobs, where jobs[i] is the amount of time it takes to complete the ith job.

HardSometimes
arraydynamic-programmingbacktracking

Minimum Cost Tree From Leaf Values

Solve

Given an array arr of positive integers, consider all binary trees such that:

MediumSometimes
arraydynamic-programmingstack

Decode Ways II

Solve

A message containing letters from A-Z can be encoded into numbers using the following mapping:

HardSometimes
stringdynamic-programming

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

String Compression

Solve

Given an array of characters chars, compress it using the following algorithm:

MediumSometimes
two-pointersstring

Binary Tree Level Order Traversal

Solve

Given the root of a binary tree, return the level order traversal of its nodes' values. (i.e., from left to right, level by level).

MediumSometimes
treebreadth-first-searchbinary-tree

Insert Interval

Solve

You are given an array of non-overlapping intervals intervals where intervals[i] = [starti, endi] represent the start and the end of the ith interval and interv...

MediumSometimes
array

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

HardSometimes
arraystackmonotonic-stack

First Missing Positive

Solve

Given an unsorted integer array nums. Return the smallest positive integer that is not present in nums.

HardSometimes
arrayhash-table

Generate Parentheses

Solve

Given n pairs of parentheses, write a function to generate all combinations of well-formed parentheses.

MediumSometimes
stringdynamic-programmingbacktracking

Jump Game

Solve

You are given an integer array nums. You are initially positioned at the array's first index, and each element in the array represents your maximum jump length...

MediumSometimes
arraydynamic-programminggreedy

Asteroid Collision

Solve

We are given an array asteroids of integers representing asteroids in a row. The indices of the asteroid in the array represent their relative position in space...

MediumSometimes
arraystacksimulation

Group Anagrams

Solve

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

MediumSometimes
arrayhash-tablestring

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

MediumSometimes
arraystackmonotonic-stack

Longest Common Prefix

Solve

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

EasySometimes
arraystringtrie

Complete Binary Tree Inserter

Solve

A complete binary tree is a binary tree in which every level, except possibly the last, is completely filled, and all nodes are as far left as possible.

MediumSometimes
treebreadth-first-searchdesign

Evaluate Division

Solve

You are given an array of variable pairs equations and an array of real numbers values, where equations[i] = [Ai, Bi] and values[i] represent the equation Ai /...

MediumSometimes
arraystringdepth-first-search

Magnetic Force Between Two Balls

Solve

In the universe Earth C-137, Rick discovered a special form of magnetic force between two balls if they are put in his new invented basket. Rick has n empty bas...

MediumSometimes
arraybinary-searchsorting

Find All Possible Recipes from Given Supplies

Solve

You have information about n different recipes. You are given a string array recipes and a 2D string array ingredients. The ith recipe has the name recipes[i],...

MediumSometimes
arrayhash-tablestring

Gas Station

Solve

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

MediumSometimes
arraygreedy

Longest Repeating Character Replacement

Solve

You are given a string s and an integer k. You can choose any character of the string and change it to any other uppercase English character. You can perform th...

MediumSometimes
hash-tablestringsliding-window

Sum of Subarray Minimums

Solve

Given an array of integers arr, find the sum of min(b), where b ranges over every (contiguous) subarray of arr. Since the answer may be large, return the answer...

MediumSometimes
arraydynamic-programmingstack

Longest Consecutive Sequence

Solve

Given an unsorted array of integers nums, return the length of the longest consecutive elements sequence.

MediumSometimes
arrayhash-tableunion-find

Partition Array Into Two Arrays to Minimize Sum Difference

Solve

You are given an integer array nums of 2 n integers. You need to partition nums into two arrays of length n to minimize the absolute difference of the sums of t...

HardSometimes
arraytwo-pointersbinary-search

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

HardSometimes
arrayhash-tablebinary-search

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

Very Likely

75-100%

Likely

50-74%

Sometimes

25-49%

Rare

0-24%

Preparing for your PhonePe coding interview

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

PhonePe has been reported to ask 89 distinct coding problems. The most common topics are array, dynamic-programming, hash-table. 2 are Easy difficulty, 57 are Medium, and 30 are Hard. Problems are sorted by frequency - the ones at the top are asked most often.

How hard are PhonePe coding interviews?add

Based on 89 reported problems, PhonePe interviews are significantly harder than average - 34% Hard vs 18% across all companies. 64% 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 PhonePe coding interview?add

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

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

Simulate a PhonePe interview with AIarrow_forward