Problem database last updated: June 20, 2025

PPayPal logo

PayPal Coding Interview Questions

94 problems · 19 Easy, 59 Medium, 16 Hard · Ranked #20 of 458

Difficulty breakdown

19 Easy

20% · avg 23%

59 Medium

63% · avg 59%

16 Hard

17% · avg 18%

Top topics

array
69.1%
hash-table
27.7%
string
23.4%
sorting
22.3%1.5x
binary-search
16%1.8x
dynamic-programming
16%

Interview profile

Based on 94 reported problems, PayPal interviews are in line with industry averages - 17% Hard vs 18% overall. The majority (63%) 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, PayPal puts unusual emphasis on prefix-sum (8.5% of problems, 2.6x the industry average), counting (8.5% of problems, 2.5x the industry average), quickselect (2.1% of problems, 2x the industry average). If you're short on time, these are the categories to double down on.

The most common topics are array (69.1%), hash-table (27.7%), string (23.4%), sorting (22.3%). Problems below are sorted by frequency, the ones at the top are asked most often.

All 94 problems

Zigzag Conversion

Solve

The string "PAYPALISHIRING" is written in a zigzag pattern on a given number of rows like this: (you may want to display this pattern in a fixed font for better...

MediumVery Likely
string

LRU Cache

Solve

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

MediumVery Likely
hash-tablelinked-listdesign

Count the Number of Vowel Strings in Range

Solve

You are given a 0-indexed array of string words and two integers left and right.

EasyVery Likely
arraystringcounting

Count Vowel Strings in Ranges

Solve

You are given a 0-indexed array of strings words and a 2D array of integers queries.

MediumVery Likely
arraystringprefix-sum

Minimum Replacements to Sort the Array

Solve

You are given a 0-indexed integer array nums. In one operation you can replace any element of the array with any two elements that sum to it.

HardVery Likely
arraymathgreedy

Number of Valid Move Combinations On Chessboard

Solve

There is an 8 x 8 chessboard containing n pieces (rooks, queens, or bishops). You are given a string array pieces of length n, where pieces[i] describes the typ...

HardVery Likely
arraystringbacktracking

Maximum Number of Integers to Choose From a Range I

Solve

You are given an integer array banned and two integers n and maxSum. You are choosing some number of integers following the below rules:

MediumVery Likely
arrayhash-tablebinary-search

Time Needed to Rearrange a Binary String

Solve

You are given a binary string s. In one second, all occurrences of "01" are simultaneously replaced with "10". This process repeats until no occurrences of "01"...

MediumVery Likely
stringdynamic-programmingsimulation

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.

MediumVery Likely
arraydepth-first-searchbreadth-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.

MediumVery Likely
arraystringbacktracking

Minimum Non-Zero Product of the Array Elements

Solve

You are given a positive integer p. Consider an array nums (1-indexed) that consists of the integers in the inclusive range [1, 2p - 1] in their binary represen...

MediumLikely
mathgreedyrecursion

Maximum Sum Obtained of Any Permutation

Solve

We have an array of integers, nums, and an array of requests where requests[i] = [starti, endi]. The ith request asks for the sum of nums[starti] + nums[starti...

MediumLikely
arraygreedysorting

Count Array Pairs Divisible by K

Solve

Given a 0-indexed integer array nums of length n and an integer k, return the number of pairs (i, j) such that:

HardLikely
arrayhash-tablemath

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

Group Anagrams

Solve

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

MediumLikely
arrayhash-tablestring

Paint House III

Solve

There is a row of m houses in a small city, each house must be painted with one of the n colors (labeled from 1 to n), some houses that have been painted last s...

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

EasyLikely
arrayhash-map

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

Longest Increasing Subsequence

Solve

Given an integer array nums, return the length of the longest strictly increasing subsequence.

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

MediumLikely
arraydynamic-programmingbreadth-first-search

Product of Array Except Self

Solve

Given an integer array nums, return an array answer such that answer[i] is equal to the product of all the elements of nums except nums[i].

MediumLikely
arrayprefix-sum

Pairs of Songs With Total Durations Divisible by 60

Solve

You are given a list of songs where the ith song has a duration of time[i] seconds.

MediumLikely
arrayhash-tablecounting

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 Substring Without Repeating Characters

Solve

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

MediumLikely
hash-tablestringsliding-window

Subarray Sum Equals K

Solve

Given an array of integers nums and an integer k, return the total number of subarrays whose sum equals to k.

MediumLikely
arrayhash-tableprefix-sum

Merge Sorted Array

Solve

You are given two integer arrays nums1 and nums2, sorted in non-decreasing order, and two integers m and n, representing the number of elements in nums1 and num...

EasyLikely
arraytwo-pointerssorting

Minimum Absolute Difference

Solve

Given an array of distinct integers arr, find all pairs of elements with the minimum absolute difference of any two elements.

EasyLikely
arraysorting

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.

MediumLikely
arraygreedysorting

Find the Smallest Divisor Given a Threshold

Solve

Given an array of integers nums and an integer threshold, we will choose a positive integer divisor, divide all the array by it, and sum the division's result....

MediumLikely
arraybinary-search

Reorganize String

Solve

Given a string s, rearrange the characters of s so that any two adjacent characters are not the same.

MediumLikely
hash-tablestringgreedy

Loud and Rich

Solve

There is a group of n people labeled from 0 to n - 1 where each person has a different amount of money and a different level of quietness.

MediumLikely
arraydepth-first-searchgraph

Meeting Rooms III

Solve

You are given an integer n. There are n rooms numbered from 0 to n - 1.

HardLikely
arrayhash-tablesorting

Last Stone Weight

Solve

You are given an array of integers stones where stones[i] is the weight of the ith stone.

EasyLikely
arrayheap-priority-queue

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

Count Vowel Substrings of a String

Solve

A substring is a contiguous (non-empty) sequence of characters within a string.

EasyLikely
hash-tablestring

Valid Anagram

Solve

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

EasyLikely
hash-tablestringsorting

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

Valid Parentheses

Solve

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

EasyLikely
stringstack

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

Random Pick with Weight

Solve

You are given a 0-indexed array of positive integers w where w[i] describes the weight of the ith index.

MediumLikely
arraymathbinary-search

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

Flatten Deeply Nested Array

Solve

Given a multi-dimensional array arr and a depth n, return a flattened version of that array.

MediumSometimes

Kth Largest Element in an Array

Solve

Given an integer array nums and an integer k, return the kth largest element in the array.

MediumSometimes
arraydivide-and-conquersorting

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.

MediumSometimes
arraytwo-pointerssorting

Happy Number

Solve

Write an algorithm to determine if a number n is happy.

EasySometimes
hash-tablemathtwo-pointers

Maximum Subarray

Solve

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

MediumSometimes
arraydivide-and-conquerdynamic-programming

Find First and Last Position of Element in Sorted Array

Solve

Given an array of integers nums sorted in non-decreasing order, find the starting and ending position of a given target value.

MediumSometimes
arraybinary-search

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.

MediumSometimes
arraybinary-search

Reverse Linked List

Solve

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

EasySometimes
linked-listrecursion

Palindromic Substrings

Solve

Given a string s, return the number of palindromic substrings in it.

MediumSometimes
two-pointersstringdynamic-programming

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

Search in Rotated Sorted Array

Solve

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

MediumSometimes
arraybinary-search

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

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

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

HardSometimes
arraystringsimulation

Count and Say

Solve

The count-and-say sequence is a sequence of digit strings defined by the recursive formula:

MediumSometimes
string

Subarray Product Less Than K

Solve

Given an array of integers nums and an integer k, return the number of contiguous subarrays where the product of all the elements in the subarray is strictly le...

MediumSometimes
arraybinary-searchsliding-window

Longest Consecutive Sequence

Solve

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

MediumSometimes
arrayhash-tableunion-find

Degree of an Array

Solve

Given a non-empty array of non-negative integers nums, the degree of this array is defined as the maximum frequency of any one of its elements.

EasySometimes
arrayhash-table

LFU Cache

Solve

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

HardSometimes
hash-tablelinked-listdesign

Minimum Increment to Make Array Unique

Solve

You are given an integer array nums. In one move, you can pick an index i where 0 <= i < nums.length and increment nums[i] by 1.

MediumSometimes
arraygreedysorting

Minimum Number of Swaps to Make the String Balanced

Solve

You are given a 0-indexed string s of even length n. The string consists of exactly n / 2 opening brackets '[' and n / 2 closing brackets ']'.

MediumSometimes
two-pointersstringstack

Rotate Image

Solve

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

MediumSometimes
arraymathmatrix

Minimum Number of Removals to Make Mountain Array

Solve

You may recall that an array arr is a mountain array if and only if:

HardSometimes
arraybinary-searchdynamic-programming

Merge In Between Linked Lists

Solve

You are given two linked lists: list1 and list2 of sizes n and m respectively.

MediumSometimes
linked-list

Maximum Product Subarray

Solve

Given an integer array nums, find a subarray that has the largest product, and return the product.

MediumSometimes
arraydynamic-programming

Design Twitter

Solve

Design a simplified version of Twitter where users can post tweets, follow/unfollow another user, and is able to see the 10 most recent tweets in the user's new...

MediumSometimes
hash-tablelinked-listdesign

Path Sum

Solve

Given the root of a binary tree and an integer targetSum, return true if the tree has a root-to-leaf path such that adding up all the values along the path equa...

EasySometimes
treedepth-first-searchbreadth-first-search

Maximum Frequency Stack

Solve

Design a stack-like data structure to push elements to the stack and pop the most frequent element from the stack.

HardSometimes
hash-tablestackdesign

Number of Substrings Containing All Three Characters

Solve

Given a string s consisting only of characters a, b and c.

MediumSometimes
hash-tablestringsliding-window

First Unique Character in a String

Solve

Given a string s, find the first non-repeating character in it and return its index. If it does not exist, return -1.

EasySometimes
hash-tablestringqueue

Divide Players Into Teams of Equal Skill

Solve

You are given a positive integer array skill of even length n where skill[i] denotes the skill of the ith player. Divide the players into n / 2 teams of size 2...

MediumSometimes
arrayhash-tabletwo-pointers

Flatten Binary Tree to Linked List

Solve

Given the root of a binary tree, flatten the tree into a "linked list":

MediumSometimes
linked-liststacktree

Delete Node in a Linked List

Solve

There is a singly-linked list head and we want to delete a node node in it.

MediumSometimes
linked-list

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

MediumSometimes
depth-first-searchbreadth-first-searchgraph

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

Process Tasks Using Servers

Solve

You are given two 0-indexed integer arrays servers and tasks of lengths n​​​​​​ and m​​​​​​ respectively. servers[i] is the weight of the i​​​​​​th​​​​ server,...

MediumSometimes
arrayheap-priority-queue

Squares of a Sorted Array

Solve

Given an integer array nums sorted in non-decreasing order, return an array of the squares of each number sorted in non-decreasing order.

EasySometimes
arraytwo-pointerssorting

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

HardSometimes
arraybinary-searchdynamic-programming

Find Median from Data Stream

Solve

The median is the middle value in an ordered integer list. If the size of the list is even, there is no middle value, and the median is the mean of the two midd...

HardSometimes
two-pointersdesignsorting

Find Pivot Index

Solve

Given an array of integers nums, calculate the pivot index of this array.

EasySometimes
arrayprefix-sum

Minimum Window Substring

Solve

Given two strings s and t of lengths m and n respectively, return the minimum window substring of s such that every character in t (including duplicates) is inc...

HardSometimes
hash-tablestringsliding-window

First Missing Positive

Solve

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

HardSometimes
arrayhash-table

Jump Game II

Solve

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

MediumSometimes
arraydynamic-programminggreedy

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

Find Peak Element

Solve

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

MediumSometimes
arraybinary-search

Spiral Matrix

Solve

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

MediumSometimes
arraymatrixsimulation

Lexicographically Smallest Palindrome

Solve

You are given a string s consisting of lowercase English letters, and you are allowed to perform operations on it. In one operation, you can replace a character...

EasySometimes
two-pointersstringgreedy

Maximum Population Year

Solve

You are given a 2D integer array logs where each logs[i] = [birthi, deathi] indicates the birth and death years of the ith person.

EasySometimes
arraycountingprefix-sum

Find Minimum in Rotated Sorted Array

Solve

Suppose an array of length n sorted in ascending order is rotated between 1 and n times. For example, the array nums = [0,1,2,4,5,6,7] might become:

MediumSometimes
arraybinary-search

Search a 2D Matrix II

Solve

Write an efficient algorithm that searches for a value target in an m x n integer matrix matrix. This matrix has the following properties:

MediumSometimes
arraybinary-searchdivide-and-conquer

Invalid Transactions

Solve

A transaction is possibly invalid if:

MediumSometimes
arrayhash-tablestring

Intersection of Two Arrays

Solve

Given two integer arrays nums1 and nums2, return an array of their intersection. Each element in the result must be unique and you may return the result in any...

EasySometimes
arrayhash-tabletwo-pointers

Min Stack

Solve

Design a stack that supports push, pop, top, and retrieving the minimum element in constant time.

MediumSometimes
stackdesign

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

Very Likely

75-100%

Likely

50-74%

Sometimes

25-49%

Rare

0-24%

Preparing for your PayPal coding interview

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

PayPal has been reported to ask 94 distinct coding problems. The most common topics are array, hash-table, string. 19 are Easy difficulty, 59 are Medium, and 16 are Hard. Problems are sorted by frequency - the ones at the top are asked most often.

How hard are PayPal coding interviews?add

Based on 94 reported problems, PayPal interviews are in line with industry averages - 17% Hard vs 18% overall. 63% 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 PayPal coding interview?add

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

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

Simulate a PayPal interview with AIarrow_forward