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 IBM interviews.
Very Likely
75-100%
Likely
50-74%
Sometimes
25-49%
Rare
0-24%
Problem database last updated: June 20, 2025
93 problems · 26 Easy, 59 Medium, 8 Hard · Ranked #23 of 458
26 Easy
28% · avg 23%
59 Medium
63% · avg 59%
8 Hard
9% · avg 18%
Based on 93 reported problems, IBM interviews are in line with industry averages - 9% 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, IBM puts unusual emphasis on number-theory (2.2% of problems, 4.2x the industry average), prefix-sum (11.8% of problems, 3.6x the industry average), bit-manipulation (8.6% of problems, 2.6x the industry average). If you're short on time, these are the categories to double down on.
The most common topics are array (67.7%), string (28%), hash-table (23.7%), sorting (19.4%). Problems below are sorted by frequency, the ones at the top are asked most often.
| Problem | Difficulty | Frequency | Topics | |
|---|---|---|---|---|
Exclusive Time of Functions On a single-threaded CPU, we execute a program containing n functions. Each function has a unique ID between 0 and n-1. | Medium | Very Likely | arraystack | Solve |
Integer to Roman Seven different symbols represent Roman numerals with the following values: | Medium | Very Likely | hash-tablemathstring | Solve |
Fizz Buzz Given an integer n, return a string array answer (1-indexed) where: | Easy | Very Likely | mathstringsimulation | Solve |
Roman to Integer Roman numerals are represented by seven different symbols: I, V, X, L, C, D and M. | Easy | Very Likely | hash-tablemathstring | Solve |
Best Time to Buy and Sell Stock You are given an array prices where prices[i] is the price of a given stock on the ith day. | Easy | Very Likely | arraydynamic-programming | Solve |
Two Sum Given an array of integers nums and an integer target, return the indices of the two numbers that add up to target. | Easy | Very Likely | arrayhash-map | Solve |
Count Ways to Group Overlapping Ranges You are given a 2D integer array ranges where ranges[i] = [starti, endi] denotes that all integers between starti and endi (both inclusive) are contained in the... | Medium | Very Likely | arraysorting | Solve |
Minimum Operations to Make All Array Elements Equal You are given an array nums consisting of positive integers. | Medium | Very Likely | arraybinary-searchsorting | Solve |
Rotate Image You are given an n x n 2D matrix representing an image, rotate the image by 90 degrees (clockwise). | Medium | Very Likely | arraymathmatrix | Solve |
Minimum Absolute Difference Given an array of distinct integers arr, find all pairs of elements with the minimum absolute difference of any two elements. | Easy | Very Likely | arraysorting | Solve |
Minimum Operations to Make Median of Array Equal to K You are given an integer array nums and a non-negative integer k. In one operation, you can increase or decrease any element by 1. | Medium | Very Likely | arraygreedysorting | Solve |
Find The First Player to win K Games in a Row A competition consists of n players numbered from 0 to n - 1. | Medium | Likely | arraysimulation | Solve |
The kth Factor of n You are given two positive integers n and k. A factor of an integer n is defined as an integer i where n % i == 0. | Medium | Likely | mathnumber-theory | Solve |
Average Value of Even Numbers That Are Divisible by Three Given an integer array nums of positive integers, return the average value of all even integers that are divisible by 3. | Easy | Likely | arraymath | Solve |
Longest Substring Without Repeating Characters Given a string s, find the length of the longest substring without duplicate characters. | Medium | Likely | hash-tablestringsliding-window | Solve |
Merge Intervals 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... | Medium | Likely | arraysorting | Solve |
String Compression Given an array of characters chars, compress it using the following algorithm: | Medium | Likely | two-pointersstring | Solve |
Count Vowel Strings in Ranges You are given a 0-indexed array of strings words and a 2D array of integers queries. | Medium | Likely | arraystringprefix-sum | Solve |
Count the Number of Incremovable Subarrays II You are given a 0-indexed array of positive integers nums. | Hard | Likely | arraytwo-pointersbinary-search | Solve |
Minimum Levels to Gain More Points You are given a binary array possible of length n. | Medium | Likely | arrayprefix-sum | Solve |
Sort the Students by Their Kth Score There is a class with m students and n exams. You are given a 0-indexed m x n integer matrix score, where each row represents one student and score[i][j] denote... | Medium | Likely | arraysortingmatrix | Solve |
Minimum Length of String After Operations You are given a string s. | Medium | Likely | hash-tablestringcounting | Solve |
Find Products of Elements of Big Array The powerful array of a non-negative integer x is defined as the shortest sorted array of powers of two that sum up to x. The table below illustrates examples o... | Hard | Likely | arraybinary-searchbit-manipulation | Solve |
Type of Triangle You are given a 0-indexed integer array nums of size 3 which can form the sides of a triangle. | Easy | Likely | arraymathsorting | Solve |
Taking Maximum Energy From the Mystic Dungeon In a mystic dungeon, n magicians are standing in a line. Each magician has an attribute that gives you energy. Some magicians can give you negative energy, whic... | Medium | Likely | arraydynamic-programmingprefix-sum | Solve |
Find Occurrences of an Element in an Array You are given an integer array nums, an integer array queries, and an integer x. | Medium | Likely | arrayhash-table | Solve |
Find the Array Concatenation Value You are given a 0-indexed integer array nums. | Easy | Likely | arraytwo-pointerssimulation | Solve |
Maximum Units on a Truck You are assigned to put some amount of boxes onto one truck. You are given a 2D array boxTypes, where boxTypes[i] = [numberOfBoxesi, numberOfUnitsPerBoxi]: | Easy | Likely | arraygreedysorting | Solve |
Longest Common Prefix Write a function to find the longest common prefix string amongst an array of strings. | Easy | Likely | arraystringtrie | Solve |
Count Binary Substrings Given a binary string s, return the number of non-empty substrings that have the same number of 0's and 1's, and all the 0's and all the 1's in these substrings... | Easy | Likely | two-pointersstring | Solve |
Get Equal Substrings Within Budget You are given two strings s and t of the same length and an integer maxCost. | Medium | Likely | stringbinary-searchsliding-window | Solve |
Valid Parentheses Given a string s containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input string is valid. | Easy | Likely | stringstack | Solve |
Letter Combinations of a Phone Number Given a string containing digits from 2-9 inclusive, return all possible letter combinations that the number could represent. Return the answer in any order. | Medium | Likely | hash-tablestringbacktracking | Solve |
Minimum Suffix Flips You are given a 0-indexed binary string target of length n. You have another binary string s of length n that is initially set to all zeros. You want to make s... | Medium | Likely | stringgreedy | Solve |
Numbers With Repeated Digits Given an integer n, return the number of positive integers in the range [1, n] that have at least one repeated digit. | Hard | Likely | mathdynamic-programming | Solve |
Maximum Sum of Distinct Subarrays With Length K You are given an integer array nums and an integer k. Find the maximum subarray sum of all the subarrays of nums that meet the following conditions: | Medium | Likely | arrayhash-tablesliding-window | Solve |
Merge Sorted Array 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... | Easy | Likely | arraytwo-pointerssorting | Solve |
Longest Palindromic Substring Given a string s, return the longest palindromic substring in s. | Medium | Likely | two-pointersstringdynamic-programming | Solve |
Lexicographically Smallest String After Substring Operation Given a string s consisting of lowercase English letters. Perform the following operation: | Medium | Likely | stringgreedy | Solve |
Longest Consecutive Sequence Given an unsorted array of integers nums, return the length of the longest consecutive elements sequence. | Medium | Likely | arrayhash-tableunion-find | Solve |
Spiral Matrix Given an m x n matrix, return all elements of the matrix in spiral order. | Medium | Likely | arraymatrixsimulation | Solve |
Shortest and Lexicographically Smallest Beautiful String You are given a binary string s and a positive integer k. | Medium | Likely | stringsliding-window | Solve |
Count Pairs Of Similar Strings You are given a 0-indexed string array words. | Easy | Likely | arrayhash-tablestring | Solve |
Maximum Subarray Given an integer array nums, find the subarray with the largest sum, and return its sum. | Medium | Likely | arraydivide-and-conquerdynamic-programming | Solve |
Divide Players Into Teams of Equal Skill 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... | Medium | Likely | arrayhash-tabletwo-pointers | Solve |
Group Anagrams Given an array of strings strs, group the anagrams together. You can return the answer in any order. | Medium | Likely | arrayhash-tablestring | Solve |
Subarray Product Less Than K 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... | Medium | Likely | arraybinary-searchsliding-window | Solve |
Minimum Swaps to Group All 1's Together II A swap is defined as taking two distinct positions in an array and swapping the values in them. | Medium | Likely | arraysliding-window | Solve |
Climbing Stairs You are climbing a staircase. It takes n steps to reach the top. | Easy | Likely | mathdynamic-programmingmemoization | Solve |
Smallest Missing Non-negative Integer After Operations You are given a 0-indexed integer array nums and an integer value. | Medium | Likely | arrayhash-tablemath | Solve |
Validate Binary Search Tree Given the root of a binary tree, determine if it is a valid binary search tree (BST). | Medium | Likely | treedepth-first-searchbinary-search-tree | Solve |
Trapping Rain Water 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. | Hard | Sometimes | arraytwo-pointersdynamic-programming | Solve |
Backspace String Compare Given two strings s and t, return true if they are equal when both are typed into empty text editors. '' means a backspace character. | Easy | Sometimes | two-pointersstringstack | Solve |
Number of Operations to Make Network Connected There are n computers numbered from 0 to n - 1 connected by ethernet cables connections forming a network where connections[i] = [ai, bi] represents a connectio... | Medium | Sometimes | depth-first-searchbreadth-first-searchunion-find | Solve |
Rotate Array Given an integer array nums, rotate the array to the right by k steps, where k is non-negative. | Medium | Sometimes | arraymathtwo-pointers | Solve |
Intersection of Two Arrays 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... | Easy | Sometimes | arrayhash-tabletwo-pointers | Solve |
Find Minimum in Rotated Sorted Array 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: | Medium | Sometimes | arraybinary-search | Solve |
Odd String Difference You are given an array of equal-length strings words. Assume that the length of each string is n. | Easy | Sometimes | arrayhash-tablestring | Solve |
Single-Threaded CPU You are given n tasks labeled from 0 to n - 1 represented by a 2D integer array tasks, where tasks[i] = [enqueueTimei, processingTimei] means that the i... | Medium | Sometimes | arraysortingheap-priority-queue | Solve |
Palindrome Number Given an integer x, return true if x is a palindrome, and false otherwise. | Easy | Sometimes | math | Solve |
Subarray Sum Equals K Given an array of integers nums and an integer k, return the total number of subarrays whose sum equals to k. | Medium | Sometimes | arrayhash-tableprefix-sum | Solve |
Flipping an Image Given an n x n binary matrix image, flip the image horizontally, then invert it, and return the resulting image. | Easy | Sometimes | arraytwo-pointersbit-manipulation | Solve |
Flip String to Monotone Increasing A binary string is monotone increasing if it consists of some number of 0's (possibly none), followed by some number of 1's (also possibly none). | Medium | Sometimes | stringdynamic-programming | Solve |
Find The Original Array of Prefix Xor You are given an integer array pref of size n. Find and return the array arr of size n that satisfies: | Medium | Sometimes | arraybit-manipulation | Solve |
Product of Array Except Self 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]. | Medium | Sometimes | arrayprefix-sum | Solve |
Longest Increasing Subsequence Given an integer array nums, return the length of the longest strictly increasing subsequence. | Medium | Sometimes | arraybinary-searchdynamic-programming | Solve |
Next Permutation A permutation of an array of integers is an arrangement of its members into a sequence or linear order. | Medium | Sometimes | arraytwo-pointers | Solve |
Find the Index of the First Occurrence in a String Given two strings needle and haystack, return the index of the first occurrence of needle in haystack, or -1 if needle is not part of haystack. | Easy | Sometimes | two-pointersstringstring-matching | Solve |
Median of Two Sorted Arrays Given two sorted arrays nums1 and nums2 of size m and n respectively, return the median of the two sorted arrays. | Hard | Sometimes | arraybinary-searchdivide-and-conquer | Solve |
Subsets Given an integer array nums of unique elements, return all possible subsets (the power set). | Medium | Sometimes | arraybacktrackingbit-manipulation | Solve |
Generate Parentheses Given n pairs of parentheses, write a function to generate all combinations of well-formed parentheses. | Medium | Sometimes | stringdynamic-programmingbacktracking | Solve |
Range Product Queries of Powers Given a positive integer n, there exists a 0-indexed array called powers, composed of the minimum number of powers of 2 that sum to n. The array is sorted in no... | Medium | Sometimes | arraybit-manipulationprefix-sum | Solve |
N-Queens The n-queens puzzle is the problem of placing n queens on an n x n chessboard such that no two queens attack each other. | Hard | Sometimes | arraybacktracking | Solve |
Find All Possible Stable Binary Arrays II You are given 3 positive integers zero, one, and limit. | Hard | Sometimes | dynamic-programmingprefix-sum | Solve |
Removing Stars From a String You are given a string s, which contains stars . | Medium | Sometimes | stringstacksimulation | Solve |
Minimum Number of Flips to Make the Binary String Alternating You are given a binary string s. You are allowed to perform two types of operations on the string in any sequence: | Medium | Sometimes | stringdynamic-programmingsliding-window | Solve |
Rearrange Array to Maximize Prefix Score You are given a 0-indexed integer array nums. You can rearrange the elements of nums to any order (including the given order). | Medium | Sometimes | arraygreedysorting | Solve |
132 Pattern Given an array of n integers nums, a 132 pattern is a subsequence of three integers nums[i], nums[j] and nums[k] such that i < j < k and nums[i] < nums[k] < num... | Medium | Sometimes | arraybinary-searchstack | Solve |
The Employee That Worked on the Longest Task There are n employees, each with a unique id from 0 to n - 1. | Easy | Sometimes | array | Solve |
Count Number of Teams There are n soldiers standing in a line. Each soldier is assigned a unique rating value. | Medium | Sometimes | arraydynamic-programmingbinary-indexed-tree | Solve |
Minimum Operations to Reduce an Integer to 0 You are given a positive integer n, you can do the following operation any number of times: | Medium | Sometimes | dynamic-programminggreedybit-manipulation | Solve |
Prime In Diagonal You are given a 0-indexed two-dimensional integer array nums. | Easy | Sometimes | arraymathmatrix | Solve |
Majority Element Given an array nums of size n, return the majority element. | Easy | Sometimes | arrayhash-tabledivide-and-conquer | Solve |
Find the Duplicate Number Given an array of integers nums containing n + 1 integers where each integer is in the range [1, n] inclusive. | Medium | Sometimes | arraytwo-pointersbinary-search | Solve |
Least Number of Unique Integers after K Removals Given an array of integers arr and an integer k. Find the least number of unique integers after removing exactly k elements. | Medium | Sometimes | arrayhash-tablegreedy | Solve |
Partition Equal Subset Sum 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... | Medium | Sometimes | arraydynamic-programming | Solve |
Task Scheduler You are given an array of CPU tasks, each labeled with a letter from A to Z, and a number n. Each CPU interval can be idle or allow the completion of one task.... | Medium | Sometimes | arrayhash-tablegreedy | Solve |
Increasing Triplet Subsequence Given an integer array nums, return true if there exists a triple of indices (i, j, k) such that i < j < k and nums[i] < nums[j] < nums[k]. If no such indices e... | Medium | Sometimes | arraygreedy | Solve |
Maximum Number of Tasks You Can Assign You have n tasks and m workers. Each task has a strength requirement stored in a 0-indexed integer array tasks, with the ith task requiring tasks[i] strength to... | Hard | Sometimes | arraytwo-pointersbinary-search | Solve |
Degree of an Array 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. | Easy | Sometimes | arrayhash-table | Solve |
Word Break Given a string s and a dictionary of strings wordDict, return true if s can be segmented into a space-separated sequence of one or more dictionary words. | Medium | Sometimes | arrayhash-tablestring | Solve |
Happy Number Write an algorithm to determine if a number n is happy. | Easy | Sometimes | hash-tablemathtwo-pointers | Solve |
LRU Cache Design a data structure that follows the constraints of a Least Recently Used (LRU) cache. | Medium | Sometimes | hash-tablelinked-listdesign | Solve |
Exclusive Time of Functions
SolveOn a single-threaded CPU, we execute a program containing n functions. Each function has a unique ID between 0 and n-1.
Integer to Roman
SolveSeven different symbols represent Roman numerals with the following values:
Fizz Buzz
SolveGiven an integer n, return a string array answer (1-indexed) where:
Roman to Integer
SolveRoman numerals are represented by seven different symbols: I, V, X, L, C, D and M.
Best Time to Buy and Sell Stock
SolveYou are given an array prices where prices[i] is the price of a given stock on the ith day.
Two Sum
SolveGiven an array of integers nums and an integer target, return the indices of the two numbers that add up to target.
Count Ways to Group Overlapping Ranges
SolveYou are given a 2D integer array ranges where ranges[i] = [starti, endi] denotes that all integers between starti and endi (both inclusive) are contained in the...
Minimum Operations to Make All Array Elements Equal
SolveYou are given an array nums consisting of positive integers.
Rotate Image
SolveYou are given an n x n 2D matrix representing an image, rotate the image by 90 degrees (clockwise).
Minimum Absolute Difference
SolveGiven an array of distinct integers arr, find all pairs of elements with the minimum absolute difference of any two elements.
Minimum Operations to Make Median of Array Equal to K
SolveYou are given an integer array nums and a non-negative integer k. In one operation, you can increase or decrease any element by 1.
Find The First Player to win K Games in a Row
SolveA competition consists of n players numbered from 0 to n - 1.
The kth Factor of n
SolveYou are given two positive integers n and k. A factor of an integer n is defined as an integer i where n % i == 0.
Average Value of Even Numbers That Are Divisible by Three
SolveGiven an integer array nums of positive integers, return the average value of all even integers that are divisible by 3.
Longest Substring Without Repeating Characters
SolveGiven a string s, find the length of the longest substring without duplicate characters.
Merge Intervals
SolveGiven an array of intervals where intervals[i] = [starti, endi], merge all overlapping intervals, and return an array of the non-overlapping intervals that cove...
String Compression
SolveGiven an array of characters chars, compress it using the following algorithm:
Count Vowel Strings in Ranges
SolveYou are given a 0-indexed array of strings words and a 2D array of integers queries.
Count the Number of Incremovable Subarrays II
SolveYou are given a 0-indexed array of positive integers nums.
Minimum Levels to Gain More Points
SolveYou are given a binary array possible of length n.
Sort the Students by Their Kth Score
SolveThere is a class with m students and n exams. You are given a 0-indexed m x n integer matrix score, where each row represents one student and score[i][j] denote...
Minimum Length of String After Operations
SolveYou are given a string s.
Find Products of Elements of Big Array
SolveThe powerful array of a non-negative integer x is defined as the shortest sorted array of powers of two that sum up to x. The table below illustrates examples o...
Type of Triangle
SolveYou are given a 0-indexed integer array nums of size 3 which can form the sides of a triangle.
Taking Maximum Energy From the Mystic Dungeon
SolveIn a mystic dungeon, n magicians are standing in a line. Each magician has an attribute that gives you energy. Some magicians can give you negative energy, whic...
Find Occurrences of an Element in an Array
SolveYou are given an integer array nums, an integer array queries, and an integer x.
Find the Array Concatenation Value
SolveYou are given a 0-indexed integer array nums.
Maximum Units on a Truck
SolveYou are assigned to put some amount of boxes onto one truck. You are given a 2D array boxTypes, where boxTypes[i] = [numberOfBoxesi, numberOfUnitsPerBoxi]:
Longest Common Prefix
SolveWrite a function to find the longest common prefix string amongst an array of strings.
Count Binary Substrings
SolveGiven a binary string s, return the number of non-empty substrings that have the same number of 0's and 1's, and all the 0's and all the 1's in these substrings...
Get Equal Substrings Within Budget
SolveYou are given two strings s and t of the same length and an integer maxCost.
Valid Parentheses
SolveGiven a string s containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input string is valid.
Letter Combinations of a Phone Number
SolveGiven a string containing digits from 2-9 inclusive, return all possible letter combinations that the number could represent. Return the answer in any order.
Minimum Suffix Flips
SolveYou are given a 0-indexed binary string target of length n. You have another binary string s of length n that is initially set to all zeros. You want to make s...
Numbers With Repeated Digits
SolveGiven an integer n, return the number of positive integers in the range [1, n] that have at least one repeated digit.
Maximum Sum of Distinct Subarrays With Length K
SolveYou are given an integer array nums and an integer k. Find the maximum subarray sum of all the subarrays of nums that meet the following conditions:
Merge Sorted Array
SolveYou 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...
Longest Palindromic Substring
SolveGiven a string s, return the longest palindromic substring in s.
Lexicographically Smallest String After Substring Operation
SolveGiven a string s consisting of lowercase English letters. Perform the following operation:
Longest Consecutive Sequence
SolveGiven an unsorted array of integers nums, return the length of the longest consecutive elements sequence.
Spiral Matrix
SolveGiven an m x n matrix, return all elements of the matrix in spiral order.
Shortest and Lexicographically Smallest Beautiful String
SolveYou are given a binary string s and a positive integer k.
Count Pairs Of Similar Strings
SolveYou are given a 0-indexed string array words.
Maximum Subarray
SolveGiven an integer array nums, find the subarray with the largest sum, and return its sum.
Divide Players Into Teams of Equal Skill
SolveYou 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...
Group Anagrams
SolveGiven an array of strings strs, group the anagrams together. You can return the answer in any order.
Subarray Product Less Than K
SolveGiven 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...
Minimum Swaps to Group All 1's Together II
SolveA swap is defined as taking two distinct positions in an array and swapping the values in them.
Climbing Stairs
SolveYou are climbing a staircase. It takes n steps to reach the top.
Smallest Missing Non-negative Integer After Operations
SolveYou are given a 0-indexed integer array nums and an integer value.
Validate Binary Search Tree
SolveGiven the root of a binary tree, determine if it is a valid binary search tree (BST).
Trapping Rain Water
SolveGiven 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.
Backspace String Compare
SolveGiven two strings s and t, return true if they are equal when both are typed into empty text editors. '' means a backspace character.
Number of Operations to Make Network Connected
SolveThere are n computers numbered from 0 to n - 1 connected by ethernet cables connections forming a network where connections[i] = [ai, bi] represents a connectio...
Rotate Array
SolveGiven an integer array nums, rotate the array to the right by k steps, where k is non-negative.
Intersection of Two Arrays
SolveGiven 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...
Find Minimum in Rotated Sorted Array
SolveSuppose 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:
Odd String Difference
SolveYou are given an array of equal-length strings words. Assume that the length of each string is n.
Single-Threaded CPU
SolveYou are given n tasks labeled from 0 to n - 1 represented by a 2D integer array tasks, where tasks[i] = [enqueueTimei, processingTimei] means that the i...
Palindrome Number
SolveGiven an integer x, return true if x is a palindrome, and false otherwise.
Subarray Sum Equals K
SolveGiven an array of integers nums and an integer k, return the total number of subarrays whose sum equals to k.
Flipping an Image
SolveGiven an n x n binary matrix image, flip the image horizontally, then invert it, and return the resulting image.
Flip String to Monotone Increasing
SolveA binary string is monotone increasing if it consists of some number of 0's (possibly none), followed by some number of 1's (also possibly none).
Find The Original Array of Prefix Xor
SolveYou are given an integer array pref of size n. Find and return the array arr of size n that satisfies:
Product of Array Except Self
SolveGiven 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].
Longest Increasing Subsequence
SolveGiven an integer array nums, return the length of the longest strictly increasing subsequence.
Next Permutation
SolveA permutation of an array of integers is an arrangement of its members into a sequence or linear order.
Find the Index of the First Occurrence in a String
SolveGiven two strings needle and haystack, return the index of the first occurrence of needle in haystack, or -1 if needle is not part of haystack.
Median of Two Sorted Arrays
SolveGiven two sorted arrays nums1 and nums2 of size m and n respectively, return the median of the two sorted arrays.
Subsets
SolveGiven an integer array nums of unique elements, return all possible subsets (the power set).
Generate Parentheses
SolveGiven n pairs of parentheses, write a function to generate all combinations of well-formed parentheses.
Range Product Queries of Powers
SolveGiven a positive integer n, there exists a 0-indexed array called powers, composed of the minimum number of powers of 2 that sum to n. The array is sorted in no...
N-Queens
SolveThe n-queens puzzle is the problem of placing n queens on an n x n chessboard such that no two queens attack each other.
Find All Possible Stable Binary Arrays II
SolveYou are given 3 positive integers zero, one, and limit.
Removing Stars From a String
SolveYou are given a string s, which contains stars .
Minimum Number of Flips to Make the Binary String Alternating
SolveYou are given a binary string s. You are allowed to perform two types of operations on the string in any sequence:
Rearrange Array to Maximize Prefix Score
SolveYou are given a 0-indexed integer array nums. You can rearrange the elements of nums to any order (including the given order).
132 Pattern
SolveGiven an array of n integers nums, a 132 pattern is a subsequence of three integers nums[i], nums[j] and nums[k] such that i < j < k and nums[i] < nums[k] < num...
The Employee That Worked on the Longest Task
SolveThere are n employees, each with a unique id from 0 to n - 1.
Count Number of Teams
SolveThere are n soldiers standing in a line. Each soldier is assigned a unique rating value.
Minimum Operations to Reduce an Integer to 0
SolveYou are given a positive integer n, you can do the following operation any number of times:
Prime In Diagonal
SolveYou are given a 0-indexed two-dimensional integer array nums.
Majority Element
SolveGiven an array nums of size n, return the majority element.
Find the Duplicate Number
SolveGiven an array of integers nums containing n + 1 integers where each integer is in the range [1, n] inclusive.
Least Number of Unique Integers after K Removals
SolveGiven an array of integers arr and an integer k. Find the least number of unique integers after removing exactly k elements.
Partition Equal Subset Sum
SolveGiven 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...
Task Scheduler
SolveYou are given an array of CPU tasks, each labeled with a letter from A to Z, and a number n. Each CPU interval can be idle or allow the completion of one task....
Increasing Triplet Subsequence
SolveGiven an integer array nums, return true if there exists a triple of indices (i, j, k) such that i < j < k and nums[i] < nums[j] < nums[k]. If no such indices e...
Maximum Number of Tasks You Can Assign
SolveYou have n tasks and m workers. Each task has a strength requirement stored in a 0-indexed integer array tasks, with the ith task requiring tasks[i] strength to...
Degree of an Array
SolveGiven 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.
Word Break
SolveGiven a string s and a dictionary of strings wordDict, return true if s can be segmented into a space-separated sequence of one or more dictionary words.
Happy Number
SolveWrite an algorithm to determine if a number n is happy.
LRU Cache
SolveDesign a data structure that follows the constraints of a Least Recently Used (LRU) cache.
Frequency scores are based on crowdsourced interview reports. A higher score means the problem has been reported more often in recent IBM interviews.
Very Likely
75-100%
Likely
50-74%
Sometimes
25-49%
Rare
0-24%
IBM 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. IBM 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.
IBM has been reported to ask 93 distinct coding problems. The most common topics are array, string, hash-table. 26 are Easy difficulty, 59 are Medium, and 8 are Hard. Problems are sorted by frequency - the ones at the top are asked most often.
Based on 93 reported problems, IBM interviews are in line with industry averages - 9% Hard vs 18% overall. 63% of questions are Medium difficulty. Focus on the high-frequency Medium problems first, then work through the Hard ones.
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.
Simulate a real IBM coding interview with an AI interviewer. Get a scorecard with specific feedback on your problem-solving, code quality, and communication.
Simulate a IBM interview with AIarrow_forward