70 problems · 5 platforms

Coding Interview Questions

The problems real companies actually ask — curated from the canon of NeetCode 150, Blind 75, LeetCode Top 100, CodeSignal and more. Read the problem, study the approach, then solve it in the editor and get an AI grade.

Platform
Difficulty
Topic

70 problems

Best Time to Buy and Sell Stock

easy

Given daily prices of a stock, find the maximum profit from a single buy followed by a later sell. If no profitable transaction exists, the profit is zero.

arrayssliding-windowgreedy
#blind75#neetcode150

Binary Search

easy

Given a list of integers sorted ascending and a target, return the index of the target if present, otherwise negative one. The search must run in logarithmic time.

binary-searcharrays
#neetcode150

Climbing Stairs

easy

You are climbing a staircase that takes n steps to reach the top. Each move you may climb one or two steps. Count the number of distinct ways to reach the top.

dynamic-programmingmath
#blind75#neetcode150

Contains Duplicate

easy

Given a list of integers, decide whether any value appears more than once. Return true if at least one value is repeated, otherwise false.

arrayshashing
#blind75#neetcode150

Fizz Buzz

easy

Given a number n, return the sequence from one to n where multiples of three become Fizz, multiples of five become Buzz, multiples of both become FizzBuzz, and all other numbers stay as their string form.

mathstrings
#hackerrank#codesignal

Invert Binary Tree

easy

Given the root of a binary tree, produce its mirror image by swapping the left and right child of every node. Return the root of the inverted tree.

treesrecursion
#blind75#neetcode150

Linked List Cycle

easy

Given the head of a singly linked list, decide whether it contains a cycle, meaning some node's next pointer eventually revisits an earlier node. Use constant extra space.

linked-listtwo-pointers
#neetcode150

Maximum Depth of Binary Tree

easy

Given the root of a binary tree, return its maximum depth, defined as the number of nodes along the longest path from the root down to a leaf.

treesrecursionbfs
#neetcode150

Merge Two Sorted Lists

easy

Given the heads of two singly linked lists already sorted ascending, splice them into one sorted list and return its head. Reuse the existing nodes.

linked-listtwo-pointers
#blind75#neetcode150

Reverse Linked List

easy

Given the head of a singly linked list, reverse the list in place and return the new head. The reversal should rewire the existing nodes rather than copying values.

linked-list
#blind75#neetcode150

Roman to Integer

easy

Given a Roman numeral string, convert it to its integer value. A smaller numeral placed before a larger one is subtracted rather than added.

mathstringshashing
#top100

Same Tree

easy

Given the roots of two binary trees, decide whether they are structurally identical and hold the same values at every position. Return true only if both shape and values match.

treesrecursion
#neetcode150

Two Sum

easy

Given a list of integers and a target value, find the two distinct positions whose values add up to the target. Return those two positions. Assume exactly one such pair exists.

arrayshashing
#blind75#neetcode150

Valid Anagram

easy

Given two strings, determine whether one is a rearrangement of the other. Two strings are anagrams when they contain exactly the same characters with the same frequencies.

stringshashing
#blind75#neetcode150

Valid Palindrome

easy

Given a string, decide whether it reads the same forwards and backwards once you ignore case and consider only alphanumeric characters. Return true if it is such a palindrome.

stringstwo-pointers
#blind75#neetcode150

Valid Parentheses

easy

Given a string of bracket characters drawn from round, square, and curly pairs, decide whether every opening bracket is closed by the correct type in the correct order. Return true if the string is well balanced.

stackstrings
#blind75#neetcode150

3Sum

medium

Given a list of integers, find every unique triple of values that sums to zero. Return the list of triples without duplicates.

arraystwo-pointerssorting
#blind75#neetcode150

Binary Tree Level Order Traversal

medium

Given the root of a binary tree, return its node values grouped level by level from top to bottom, each level read left to right.

treesbfs
#neetcode150

Clone Graph

medium

Given a reference to a node in a connected undirected graph, return a deep copy of the whole graph. Each cloned node must hold the same value and a list of its cloned neighbours.

graphsdfsbfs
#neetcode150

Coin Change

medium

Given coin denominations and a target amount, return the fewest coins needed to make exactly that amount. If it cannot be made, return negative one. You have an unlimited supply of each coin.

dynamic-programming
#blind75#neetcode150

Combination Sum

medium

Given distinct positive candidates and a target, return all unique combinations that sum to the target. Each candidate may be used any number of times, and combinations differing only in order count once.

backtrackingarrays
#neetcode150

Container With Most Water

medium

Given a list of non-negative heights, each representing a vertical line on a number line, find two lines that together with the x-axis hold the most water. Return that maximum area.

arraystwo-pointersgreedy
#blind75#neetcode150

Course Schedule

medium

Given a number of courses and a list of prerequisite pairs, decide whether you can finish all courses. You can finish them only if the prerequisite relationships contain no cycle.

graphstopological-sortdfs
#blind75#neetcode150

Daily Temperatures

medium

Given a list of daily temperatures, for each day return how many days you must wait until a warmer temperature. If no warmer day exists, the answer for that day is zero.

stackmonotonic-stackarrays
#neetcode150

Encode and Decode Strings

medium

Design an encoder that serializes a list of arbitrary strings into one string, and a decoder that recovers the original list. The strings may contain any characters, including your delimiters.

stringsdesign
#neetcode150

Evaluate Reverse Polish Notation

medium

Given a list of tokens representing an arithmetic expression in postfix (Reverse Polish) notation, evaluate it. Operators are the four basic arithmetic operations and operands are integers.

stackmath
#neetcode150

Find Minimum in Rotated Sorted Array

medium

Given an ascending array of unique values rotated at an unknown pivot, return the minimum element in logarithmic time.

binary-searcharrays
#neetcode150

Group Anagrams

medium

Given a list of strings, cluster them so that words which are anagrams of each other land in the same group. Return the list of groups in any order.

stringshashing
#blind75#neetcode150

House Robber

medium

Given the amounts of money in a row of houses, find the maximum you can rob without taking from two adjacent houses, since adjacent robberies trigger the alarm.

dynamic-programming
#blind75#neetcode150

Implement Trie (Prefix Tree)

medium

Design a prefix tree supporting inserting a word, checking whether a full word exists, and checking whether any stored word starts with a given prefix.

designtriestrings
#neetcode150

Insert Interval

medium

Given a list of non-overlapping intervals sorted by start and a new interval, insert it and merge any overlaps so the result stays sorted and non-overlapping.

intervalsarrays
#neetcode150

Jump Game

medium

Given a list where each value is the maximum forward jump from that position, decide whether you can reach the last index starting from the first.

greedyarraysdynamic-programming
#neetcode150

Koko Eating Bananas

medium

Given piles of bananas and a number of hours, find the smallest integer eating speed such that all piles are finished within the time. Each hour Koko eats from one pile up to her speed, finishing partial piles in that hour.

binary-searchgreedy
#neetcode150

Kth Largest Element in an Array

medium

Given a list of integers and a number k, return the kth largest element in sorted order, where duplicates count as distinct positions. Aim for better than a full sort.

heapquickselectarrays
#neetcode150

Longest Consecutive Sequence

medium

Given an unsorted list of integers, find the length of the longest run of consecutive values. The values do not need to be adjacent in the list. Aim for linear time.

arrayshashing
#blind75#neetcode150

Longest Increasing Subsequence

medium

Given a list of integers, return the length of the longest strictly increasing subsequence. The chosen elements need not be contiguous but must keep their original order.

dynamic-programmingbinary-search
#blind75#neetcode150

Longest Repeating Character Replacement

medium

Given a string of uppercase letters and a budget k, find the length of the longest substring you can make all-identical by replacing at most k characters.

stringssliding-window
#neetcode150

Longest Substring Without Repeating Characters

medium

Given a string, find the length of the longest contiguous substring that contains no repeated character.

stringssliding-windowhashing
#blind75#neetcode150

Lowest Common Ancestor of a BST

medium

Given the root of a binary search tree and two of its nodes, return their lowest common ancestor, the deepest node that has both given nodes as descendants. A node may be a descendant of itself.

treesbst
#neetcode150

LRU Cache

medium

Design a cache with a fixed capacity that supports get and put in constant time. When the cache is full and a new key is added, evict the least recently used entry. Reading or updating a key marks it most recently used.

designhashinglinked-list
#top100#neetcode150

Maximum Subarray

medium

Given a list of integers, find the contiguous subarray with the largest sum and return that sum. The subarray must contain at least one element.

dynamic-programminggreedyarrays
#blind75#neetcode150

Merge Intervals

medium

Given a list of intervals, merge every set of overlapping intervals and return the resulting non-overlapping intervals covering the same ranges.

intervalssortingarrays
#blind75#neetcode150

Min Stack

medium

Design a stack that supports push, pop, top, and retrieving the current minimum, with every operation running in constant time. The minimum must reflect only the values currently on the stack.

stackdesign
#blind75#neetcode150

Non-overlapping Intervals

medium

Given a list of intervals, return the minimum number you must remove so that the remaining intervals do not overlap.

intervalsgreedysorting
#neetcode150

Number of Islands

medium

Given a grid of land and water cells, count the number of islands. An island is a group of land cells connected horizontally or vertically, and is surrounded by water or the grid edge.

graphsdfsbfs
#blind75#neetcode150

Partition Equal Subset Sum

medium

Given a list of positive integers, decide whether it can be split into two groups whose sums are equal.

dynamic-programmingknapsack
#neetcode150

Permutation in String

medium

Given two strings, decide whether the second contains any contiguous substring that is a permutation of the first. Return true if such a window exists.

stringssliding-windowhashing
#neetcode150

Permutations

medium

Given a list of distinct integers, return every possible ordering of them. The list of permutations may be returned in any order.

backtrackingarrays
#neetcode150

Product of Array Except Self

medium

Given a list of integers, return a new list where each position holds the product of every other value in the original list. Solve it without using division.

arraysprefix-sum
#blind75#neetcode150

Remove Nth Node From End of List

medium

Given the head of a singly linked list and a number n, remove the nth node counting from the end and return the head. Do it in a single pass.

linked-listtwo-pointers
#neetcode150

Reorder List

medium

Given a singly linked list, reorder it so it interleaves the first node, the last node, the second node, the second-to-last node, and so on. Rewire nodes in place without changing their values.

linked-listtwo-pointers
#neetcode150

Rotate Image

medium

Given an n by n matrix representing an image, rotate it ninety degrees clockwise in place without allocating another matrix.

mathmatrixarrays
#top100

Search in Rotated Sorted Array

medium

Given an ascending array that has been rotated at an unknown pivot, find the index of a target value or return negative one. Achieve logarithmic time.

binary-searcharrays
#blind75#neetcode150

Subarray Sum Equals K

medium

Given a list of integers and a target k, count how many contiguous subarrays sum to exactly k. Values may be negative.

arrayshashingprefix-sum
#top100

Subsets

medium

Given a list of distinct integers, return all possible subsets, including the empty set and the full set. The collection of subsets is the power set and may be returned in any order.

backtrackingarrays
#neetcode150

Top K Frequent Elements

medium

Given a list of integers and a number k, return the k values that occur most frequently. The answer may be returned in any order, and the k most frequent values are guaranteed to be unambiguous.

arrayshashingheap
#blind75#neetcode150

Two Sum II Sorted Input

medium

Given a list of integers already sorted in non-decreasing order and a target, return the one-based positions of the two values that add up to the target. Use constant extra space.

arraystwo-pointers
#neetcode150

Unique Paths

medium

A robot starts at the top-left of an m by n grid and may move only right or down. Count the number of distinct paths it can take to reach the bottom-right corner.

dynamic-programmingmathmatrix
#neetcode150

Valid Sudoku

medium

Given a partially filled 9x9 grid, decide whether the current placement is valid. Each row, each column, and each of the nine 3x3 sub-boxes must contain no repeated digit. Empty cells are ignored.

arrayshashingmatrix
#neetcode150

Validate Binary Search Tree

medium

Given the root of a binary tree, decide whether it is a valid binary search tree, meaning every node's value is greater than all values in its left subtree and smaller than all in its right subtree.

treesbstrecursion
#blind75#neetcode150

Word Break

medium

Given a string and a dictionary of words, decide whether the string can be segmented into a sequence of one or more dictionary words. Words may be reused.

dynamic-programmingstringshashing
#blind75#neetcode150

Word Search

medium

Given a grid of letters and a word, decide whether the word can be spelled by a path of adjacent cells moving horizontally or vertically. The same cell may not be reused within one path.

backtrackingdfsmatrix
#neetcode150

Edit Distance

hard

Given two strings, return the minimum number of single-character insertions, deletions, or substitutions needed to transform the first into the second.

dynamic-programmingstrings
#top100

Find Median from Data Stream

hard

Design a structure that accepts a stream of integers and can report the running median at any time. Support adding a number and querying the current median efficiently.

heapdesign
#neetcode150

Median of Two Sorted Arrays

hard

Given two ascending sorted arrays, return the median of their combined ordering in logarithmic time relative to the smaller array.

binary-searcharrays
#top100

Merge k Sorted Lists

hard

Given an array of k singly linked lists, each sorted ascending, merge them all into one sorted linked list and return its head.

linked-listheapdivide-and-conquer
#blind75#neetcode150

Minimum Window Substring

hard

Given a string s and a pattern t, find the shortest contiguous substring of s that contains every character of t including duplicates. If none exists, return an empty string.

stringssliding-windowhashing
#blind75#neetcode150

N-Queens

hard

Given a number n, place n queens on an n by n chessboard so that no two attack each other, and return all distinct board configurations. Queens attack along rows, columns, and both diagonals.

backtracking
#top100

Trapping Rain Water

hard

Given a list of non-negative bar heights forming an elevation map, compute how many units of water are trapped after rain. Water sits in the dips between taller bars.

arraystwo-pointersdynamic-programming
#blind75#neetcode150

Word Ladder

hard

Given a start word, an end word, and a dictionary of equal-length words, find the length of the shortest transformation sequence that changes the start into the end, altering exactly one letter at a time and keeping every intermediate word in the dictionary. Return zero if impossible.

graphsbfsstrings
#top100