Not started
Lesson 1: Two Sum
Given an array of integers and a target, return the indices of the two numbers that add up to the target.
Structured interview-style practice with Python walkthroughs for arrays, strings, linked lists, trees, graphs, greedy methods, and dynamic programming.
Structured interview-style practice with Python walkthroughs for arrays, strings, linked lists, trees, graphs, greedy methods, and dynamic programming. Every lesson pairs a video walkthrough with notes, the target complexity, and links to deeper articles.
Progress cannot be saved in this browser, so it will reset when you leave.
Each lesson opens with the task in one sentence. Sketch a solution and estimate its complexity first.
The video loads when you press play. Reveal the key idea in the notes if you get stuck.
Check the complexity table, follow a related article, and mark the lesson complete to resume later.
Start at lesson 1 for the full path, or filter by the pattern you want to practise.
76 lessons shown
Not started
Given an array of integers and a target, return the indices of the two numbers that add up to the target.
Not started
Find the length of the longest substring that contains no repeated characters.
Not started
Return the longest substring of a string that reads the same forwards and backwards.
Not started
Choose two vertical lines that, together with the x-axis, hold the most water.
Not started
Find all unique triplets in an array whose values sum to zero (LeetCode's 3Sum).
Not started
Remove the n-th node from the end of a singly linked list and return its head.
Not started
Decide whether a string of brackets ()[]{} is opened and closed in the correct order.
Not started
Merge two sorted linked lists into a single sorted list.
Not started
Merge k sorted linked lists into one sorted linked list.
Not started
Find the index of a target in a sorted array of distinct values that was rotated at an unknown pivot.
Not started
List every unique combination of candidate numbers (each usable any number of times) that sums to a target.
Not started
Rotate an n × n matrix by 90 degrees clockwise, in place.
Not started
Group a list of words so that anagrams end up together.
Not started
Find the contiguous subarray with the largest sum.
Not started
Return all elements of a matrix in spiral order.
Not started
Each element is the maximum jump length from that index. Decide whether the last index is reachable from the first.
Not started
Merge all overlapping intervals.
Not started
Insert a new interval into a sorted list of non-overlapping intervals, merging where necessary.
Not started
Count the paths from the top-left to the bottom-right of an m × n grid when you may only move right or down.
Not started
Count the distinct ways to climb n stairs when each move is one or two steps.
Not started
Whenever a matrix element is 0, set its entire row and column to 0, in place.
Not started
Find the smallest substring of s that contains every character of t, including duplicates.
Not started
Decide whether a word can be traced through horizontally or vertically adjacent grid cells, using each cell at most once.
Not started
Count the ways to decode a string of digits where 'A' = 1 … 'Z' = 26.
Not started
Check whether a binary tree is a valid binary search tree.
Not started
Check whether two binary trees have the same structure and the same node values.
Not started
Return the values of a binary tree level by level, from left to right.
Not started
Find the maximum depth of a binary tree.
Not started
Rebuild a binary tree from its preorder and inorder traversals.
Not started
Given daily stock prices, find the largest profit from one buy followed by one later sell.
Not started
Find the largest sum of any path between two nodes in a binary tree.
Not started
Decide whether a string is a palindrome after ignoring case and non-alphanumeric characters.
Not started
Find the length of the longest run of consecutive integers in an unsorted array, in O(n) time.
Not started
Return a deep copy of a connected undirected graph.
Not started
Decide whether a string can be split into a sequence of dictionary words.
Not started
Detect whether a linked list contains a cycle.
Not started
Reorder a list L0 → L1 → … → Ln into L0 → Ln → L1 → Ln−1 → …, in place.
Not started
Find the contiguous subarray with the largest product.
Not started
Find the minimum of a sorted array of distinct values that was rotated at an unknown pivot.
Not started
Reverse the bits of a 32-bit unsigned integer.
Not started
Count the number of 1 bits in an unsigned integer (its Hamming weight).
Not started
Find the most money you can rob from a row of houses without robbing two adjacent houses.
Not started
Count the islands (groups of horizontally or vertically connected land cells) in a grid.
Not started
Reverse a singly linked list.
Not started
Given course prerequisites, decide whether it is possible to finish every course.
Not started
Implement a trie with insert, search and startsWith operations.
Not started
Return an order in which all courses can be taken, or an empty list if that is impossible.
Not started
Design a word dictionary that supports adding words and searching with '.' as a wildcard letter.
Not started
Find every word from a list that can be traced through adjacent cells of a letter grid.
Not started
House Robber, but the houses stand in a circle, so the first and last house are neighbours.
Not started
Decide whether any value appears at least twice in an array.
Not started
Mirror a binary tree by swapping the left and right child of every node.
Not started
Return the k-th smallest value in a binary search tree.
Not started
Find the lowest common ancestor of two nodes in a binary search tree.
Not started
For every index, return the product of all other elements without using division.
Not started
Decide whether two strings are anagrams of each other.
Not started
An array holds n distinct numbers from the range 0 … n. Find the one that is missing.
Not started
Design a structure that accepts a stream of numbers and returns the current median.
Not started
Convert a binary tree to a string and rebuild the identical tree from that string.
Not started
Find the length of the longest strictly increasing subsequence.
Not started
Find the fewest coins needed to make an amount, or −1 if it cannot be made.
Not started
For every i from 0 to n, return how many 1 bits i has.
Not started
Return the k most frequent elements of an array.
Not started
Add two integers without using the + or − operators.
Not started
Find the grid cells from which rain water can flow to both the Pacific and the Atlantic ocean.
Not started
Find the longest substring of one repeated letter you can get after replacing at most k characters.
Not started
Find the minimum number of intervals to remove so that the rest do not overlap.
Not started
Decide whether one binary tree appears as a subtree of another.
Not started
Decide whether n new flowers can be planted in a flowerbed without any two flowers being adjacent.
Not started
Pairs (a, b) can be chained when b < c for the next pair (c, d). Find the longest possible chain.
Not started
Count the palindromic substrings of a string.
Not started
Find the length of the shortest walk that visits every node of an undirected graph, starting and ending anywhere.
Not started
In a row of seats (1 = taken, 0 = empty), choose a seat that maximizes the distance to the closest person.
Not started
Partition an array into contiguous blocks of length at most k; every element becomes its block's maximum. Maximize the final sum.
Not started
Find the length of the longest subsequence shared by two strings.
Not started
In a coloured directed graph, find the largest count of one colour along any path, or −1 if the graph has a cycle.
Try a different problem name, number, or pattern.