Coding Problems

Practice your coding skills with our collection of problems. Click on a problem to view its details.

Easy Array

Find Intersection of Two Arrays

Find common elements between two arrays.

Medium Array

Maximum Subarray

Find the contiguous subarray with the largest sum.

Hard Array

Product of Array Except Self

Return an array such that each element is the product of all elements except itself.

Easy String

Reverse a String

Write a function to reverse a string in-place.

Medium String

Check Anagram

Check if two strings are anagrams of each other.

Hard String

Longest Substring Without Repeating Characters

Find the longest substring without repeating characters.

Easy Recursion

Factorial

Find the factorial of a number using recursion.

Medium Recursion

Fibonacci Sequence

Generate the Fibonacci sequence up to a given number.

Hard Recursion

Tower of Hanoi

Move N disks from one rod to another using recursion.

Easy Dynamic Programming

Climbing Stairs

Count the number of distinct ways to climb a staircase.

Medium DP

Knapsack Problem

Solve the 0/1 Knapsack problem using dynamic programming.

Hard DP

Edit Distance

Find the minimum number of operations to convert one string to another.

Easy Tree

Binary Tree Inorder Traversal

Perform an inorder traversal of a binary tree.

Medium Tree

Lowest Common Ancestor

Find the lowest common ancestor of two nodes in a binary tree.

Hard Tree

Validate Binary Search Tree

Check if a binary tree is a valid binary search tree.

Easy Graph

Graph Valid Tree

Determine if a given graph is a valid tree.

Medium Graph

Number of Islands

Count the number of islands in a 2D grid.

Hard Graph

Course Schedule

Determine if you can finish all courses given their prerequisites.

Easy Bit Manipulation

Single Number

Find the number that appears only once in an array where every other number appears twice.

Medium Bit Manipulation

Hamming Distance

Calculate the Hamming distance between two integers.

Medium Greedy

Jump Game

Determine if you can reach the last index of an array with given jumps.

Hard Heap

Top K Frequent Elements

Find the K most frequent elements in an array.

Hard Trie

Implement Trie

Design and implement a Trie (prefix tree).

Medium Hashing

Group Anagrams

Group words that are anagrams of each other.

Medium Sorting

Merge Intervals

Merge overlapping intervals in a list.

Easy Searching

Binary Search

Find a target element in a sorted array.

Easy Linked List

Reverse Linked List

Reverse a singly linked list.

Hard Queue

Sliding Window Maximum

Find the maximum element in every sliding window of size k.

Hard Binary Search

Search in Rotated Sorted Array

Search for a target element in a rotated sorted array.

Hard Segment Tree

Range Sum Query

Find the sum of elements in a given range using a segment tree.

Medium Disjoint Set

Number of Connected Components

Find the number of connected components in an undirected graph.

Hard Geometry

Convex Hull

Find the convex hull of a set of points.

Medium Binary Tree

Binary Tree Right Side View

Return the values of the nodes that are visible from the right side of a binary tree.

Medium Array

Find Peak Element

Find a peak element in an unsorted array.

Easy Array

Find Missing Number

Find the missing number in an array containing numbers from 1 to N.

Medium Array

Find Duplicate Number

Find the duplicate number in an array of N+1 elements.

Easy Array

Merge Sorted Arrays

Merge two sorted arrays into a single sorted array.

Easy Array

Find Intersection of Two Arrays

Find common elements between two arrays.

Medium Array

Rotate Array

Rotate an array to the right by K steps.

Hard Array

Maximum Product Subarray

Find the contiguous subarray that gives the maximum product.

Medium Array

Subarray Sum Equals K

Find the number of subarrays whose sum equals K.

Medium Graph

Network Delay Time

Find the time it takes for all nodes to receive a signal in a weighted graph.

Medium String

Longest Palindromic Substring

Find the longest palindromic substring in a string.

Medium Dynamic Programming

Word Break

Determine if a string can be segmented into words from a dictionary.

Medium Dynamic Programming

Longest Common Subsequence

Find the length of the longest common subsequence between two strings.

Medium Dynamic Programming

Minimum Path Sum

Find the path with the minimum sum from top-left to bottom-right in a grid.

Medium Dynamic Programming

Unique Paths

Find the number of unique paths from top-left to bottom-right in a grid.

Hard Backtracking

N-Queens

Place N queens on an N×N chessboard such that no two queens threaten each other.

Hard Heap

Merge K Sorted Lists

Merge k sorted linked lists into one sorted linked list.

Medium Array

Maximum Subarray

Find the contiguous subarray with the largest sum.

Medium Array

Spiral Matrix

Return all elements of a matrix in spiral order.

Medium Array

Jump Game

Determine if you can reach the last index of an array.

Medium Array

Merge Intervals

Merge all overlapping intervals.

Medium Array

Insert Interval

Insert a new interval into a sorted list of non-overlapping intervals.

Easy String

Length of Last Word

Find the length of the last word in a string.

Medium Array

Spiral Matrix II

Generate a square matrix filled with elements from 1 to n^2 in spiral order.

Hard String

Permutation Sequence

Find the kth permutation sequence of n numbers.

Medium Linked List

Rotate List

Rotate a linked list to the right by k places.

Medium Dynamic Programming

Unique Paths

Find the number of unique paths from top-left to bottom-right corner of a grid.

Medium Dynamic Programming

Unique Paths II

Find unique paths in a grid with obstacles.

Medium Dynamic Programming

Minimum Path Sum

Find the path with the minimum sum from top-left to bottom-right in a grid.

Medium Array

Find the Majority Element

Find the element that appears more than N/2 times.

Medium Array

Find the First and Last Position of Element

Find the starting and ending position of a given target.

Easy Array

Sort Colors

Sort an array containing 0s, 1s, and 2s.

Hard Array

Maximize Sum of Array After K Negations

Maximize the sum of an array by flipping at most K elements.

Hard Array

Find Kth Largest Element

Find the Kth largest element in an array.

Hard Array

Three Sum

Find all unique triplets that sum up to zero.

Easy Array

Find Two Elements That Sum to K

Find two elements in an array that add up to a target value K.

Hard Array

Find the Next Permutation

Find the next lexicographical permutation of a sequence.

Medium Array

Find the Majority Element II

Find all elements that appear more than N/3 times in an array.

Hard Array

Maximum Gap

Find the maximum difference between two elements in an array.

Hard Array

K-th Smallest in Lexicographical Order

Find the K-th smallest number in lexicographical order among all integers from 1 to N.

Hard Array

Find K-th Smallest Pair Distance

Find the K-th smallest distance between two elements in an array.

Hard Array

Maximize Distance to Closest Person

Find the maximum distance to the closest person in a row of seats.

Hard Array

Minimum Number of Arrows to Burst Balloons

Find the minimum number of arrows needed to burst all balloons.

Hard Array

Minimum Number of Refueling Stops

Find the minimum number of refueling stops needed to reach a destination.

Hard Array

Minimum Cost to Merge Stones

Find the minimum cost to merge stones into a single pile.

Hard Array

Minimum Number of Operations to Make Array Continuous

Find the minimum number of operations needed to make an array continuous.

Hard Array

Minimum Number of Operations to Make Array Sorted

Find the minimum number of operations needed to make an array sorted.

Hard Array

Minimum Number of Operations to Make Array Sorted II

Find the minimum number of operations needed to make an array sorted.

Medium Divide and Conquer

Merge Sort

Implement merge sort to sort an array in ascending order.

Hard Segment Tree

Range Minimum Query

Find the minimum value in a given range using a segment tree.

Hard Disjoint Set

Union-Find with Path Compression

Implement a union-find data structure with path compression.

Medium Rolling Hash

Rabin-Karp Algorithm

Use the Rabin-Karp algorithm for string matching.

Hard Monotonic Stack

Largest Rectangle in Histogram

Find the largest rectangular area in a histogram.

Medium Geometry

Line Segment Intersection

Check if two given line segments intersect.

Medium Combinatorics

Permutations of a Set

Generate all permutations of a given set.

Hard Number Theory

Extended Euclidean Algorithm

Find the modular inverse of a number using the Extended Euclidean Algorithm.

Medium Linked List

Reverse Linked List II

Reverse a linked list from position left to position right.

Medium String

Restore IP Addresses

Given a string containing only digits, restore it by returning all possible valid IP address combinations.

Easy Binary Tree

Binary Tree Inorder Traversal

Given the root of a binary tree, return the inorder traversal of its nodes' values.

Medium Binary Tree

Unique Binary Search Trees II

Generate all structurally unique BSTs that store values 1...n.

Medium Dynamic Programming

Unique Binary Search Trees

Given n, return the number of structurally unique BSTs which has exactly n nodes of unique values from 1 to n.

Hard Dynamic Programming

Interleaving String

Given strings s1, s2, and s3, determine if s3 is formed by interleaving s1 and s2.

Medium Binary Tree

Validate Binary Search Tree

Determine if a binary tree is a valid binary search tree (BST).

Hard Binary Tree

Recover Binary Search Tree

Recover a BST where exactly two nodes were swapped by mistake.

Easy Binary Tree

Same Tree

Check if two binary trees are identical in structure and node values.

Easy Binary Tree

Symmetric Tree

Check if a binary tree is a mirror of itself (symmetric around its center).

Medium Binary Tree

Binary Tree Level Order Traversal

Return the level order traversal of a binary tree's nodes' values.

Medium Binary Tree

Binary Tree Zigzag Level Order Traversal

Return the zigzag level order traversal of a binary tree's nodes' values.

Easy Binary Tree

Maximum Depth of Binary Tree

Find the maximum depth (height) of a binary tree.

Medium Binary Tree

Construct Binary Tree from Preorder and Inorder Traversal

Construct a binary tree from its preorder and inorder traversal.

Medium Binary Tree

Construct Binary Tree from Inorder and Postorder Traversal

Construct a binary tree from its inorder and postorder traversal.

Medium Binary Tree

Binary Tree Level Order Traversal II

Return the bottom-up level order traversal of a binary tree's nodes' values.

Easy Binary Tree

Convert Sorted Array to Binary Search Tree

Convert a sorted array into a height-balanced binary search tree.

Medium Binary Tree

Convert Sorted List to Binary Search Tree

Convert a sorted linked list into a height-balanced binary search tree.

Easy Binary Tree

Balanced Binary Tree

Determine if a binary tree is height-balanced.

Easy Binary Tree

Minimum Depth of Binary Tree

Find the minimum depth of a binary tree.

Easy Binary Tree

Path Sum

Determine if a binary tree has a root-to-leaf path with a specified sum.

Medium Binary Tree

Path Sum II

Find all root-to-leaf paths where the sum equals the target sum.

Medium Binary Tree

Flatten Binary Tree to Linked List

Flatten a binary tree into a linked list in-place.

Hard Dynamic Programming

Distinct Subsequences

Count the number of distinct subsequences of s that equal t.

Medium Binary Tree

Populating Next Right Pointers in Each Node

Connect each node with its next right node in a perfect binary tree.

Medium Binary Tree

Populating Next Right Pointers in Each Node II

Connect each node with its next right node in any binary tree.

Easy Array

Pascal's Triangle

Generate the first numRows of Pascal's triangle.

Easy Array

Pascal's Triangle II

Return the rowIndex-th row of Pascal's triangle.

Medium Dynamic Programming

Triangle

Find the minimum path sum from top to bottom in a triangle array.

Easy Array

Best Time to Buy and Sell Stock

Find the maximum profit by buying and selling a stock once.

Medium Array

Best Time to Buy and Sell Stock II

Find the maximum profit by buying and selling stocks multiple times.

Hard Array

Best Time to Buy and Sell Stock III

Find the maximum profit by completing at most two transactions.

Hard Binary Tree

Binary Tree Maximum Path Sum

Find the maximum path sum between any two nodes in a binary tree.

Easy String

Valid Palindrome

Determine if a string is a valid palindrome considering only alphanumeric characters.

Hard Graph

Word Ladder II

Find all shortest transformation sequences from beginWord to endWord.

Medium Graph

Word Ladder

Find the shortest transformation sequence length from beginWord to endWord.

Medium Array

Longest Consecutive Sequence

Find the length of the longest consecutive sequence in an unsorted array.

Medium Binary Tree

Sum Root to Leaf Numbers

Calculate the total sum of all root-to-leaf numbers in a binary tree.

Medium Graph

Surrounded Regions

Capture all regions surrounded by 'X' in a board.

Medium String

Palindrome Partitioning

Find all possible palindrome partitioning of a string.

Hard DP

Palindrome Partitioning II

Find the minimum cuts needed for palindrome partitioning of a string.

Medium Graph

Clone Graph

Create a deep copy of a connected undirected graph.

Medium Greedy

Gas Station

Determine if you can complete a circular route starting from any gas station.

Hard Greedy

Candy

Distribute candies to children based on their ratings.

Medium String

Word Break

Determine if a string can be segmented into space-separated dictionary words.

Medium Linked List

Reorder List

Reorder a linked list by interleaving the first half with the reversed second half.

Hard DP

Maximum Product Subarray

Find the contiguous subarray with the largest product.

Medium Graph

Course Schedule II

Find a valid order to take all courses given their prerequisites.

Medium Trie

Add and Search Word

Design a data structure that supports adding and searching words with wildcards.

Medium Matrix

Rotate Image

Rotate an n x n matrix 90 degrees clockwise in-place.

Hard Stack

Basic Calculator

Implement a basic calculator to evaluate arithmetic expressions with parentheses.

Medium Prefix Sum

Continuous Subarray Sum

Find if there exists a continuous subarray that sums to a multiple of k.

Medium Bit Manipulation

Counting Bits

Count the number of 1's in the binary representation of every number from 0 to n.

Hard Deque

Sliding Window Maximum

Find the maximum element in each sliding window of size k.

Medium Game Theory

Nim Game

Determine if you can win a game where players take turns removing stones.

Medium Probability

Random Pick with Weight

Implement a data structure that picks an element with probability proportional to its weight.

Hard Suffix Array

Longest Repeating Substring

Find the longest substring that appears at least twice in a string using suffix arrays.

Hard Flow Network

Maximum Flow

Find the maximum flow in a flow network using Ford-Fulkerson algorithm.

Hard Approximation

Traveling Salesman Problem

Find an approximate solution to the traveling salesman problem using nearest neighbor.

Medium String Matching

KMP Pattern Matching

Implement the Knuth-Morris-Pratt pattern matching algorithm.

Medium Dynamic Connectivity

Number of Islands II

Handle dynamic addition of lands and count number of islands in real-time.

Hard Combinatorics

Count Different Palindromic Subsequences

Count the number of different palindromic subsequences in a string.

Medium Geometry

Rectangle Overlap

Determine if two rectangles overlap in 2D space.

Hard Number Theory

Prime Factorization Queries

Efficiently handle multiple prime factorization queries using preprocessing.

Medium Monotonic Stack

Next Greater Element II

Find the next greater element for each element in a circular array.

Medium Queue

Design Circular Deque

Implement a circular double-ended queue with all operations in O(1) time.

Hard Heap

Find Median from Data Stream

Design a data structure that can find the median of a stream of numbers.

Hard Searching

Median of Two Sorted Arrays

Find the median of two sorted arrays in logarithmic time complexity.

Hard Binary Search

Split Array Largest Sum

Split an array into m subarrays to minimize the largest sum among them.

Easy Array

Single Number II

Find the element that appears only once in an array where every other element appears three times.

Medium String

Group Shifted Strings

Group strings that are shifted versions of each other.

Medium DP

Best Time to Buy and Sell Stock IV

Find the maximum profit with at most k transactions.

Hard Graph

Minimum Cost to Connect Sticks

Connect sticks with minimum cost using a priority queue.

Medium Array

Find All Duplicates in an Array

Find all duplicates in an array without using extra space.

Medium String

Longest Substring with At Most K Distinct Characters

Find the length of the longest substring with at most k distinct characters.

Hard DP

Palindrome Partitioning III

Partition a string such that every substring is a palindrome with minimum cuts.

Medium Array

Maximum Length of Repeated Subarray

Find the maximum length of a subarray that appears in both arrays.

Medium String

Minimum Window Substring

Find the minimum window in a string that contains all characters of another string.

Hard DP

Longest Increasing Subsequence

Find the length of the longest increasing subsequence in an array.

Medium Array

Rotate Array II

Rotate an array to the right by k steps, where k is non-negative.

Medium String

Count and Say

Generate the nth term of the count-and-say sequence.

Hard DP

Unique Paths III

Find the number of unique paths from the top-left to the bottom-right of a grid with obstacles.

Medium Array

Product of Array Except Self II

Return an array such that each element is the product of all elements except itself, without using division.

Medium String

Longest Palindromic Subsequence

Find the length of the longest palindromic subsequence in a string.

Hard DP

Minimum Cost to Cut a Stick

Find the minimum cost to cut a stick into pieces of given lengths.

Medium Graph

Course Schedule III

Find the maximum number of courses you can take given their start and end times.

Medium Array

Find the Kth Largest Element in an Array

Find the Kth largest element in an unsorted array.

Medium String

Longest Repeating Character Replacement

Find the length of the longest substring that can be obtained by replacing at most k characters.

Hard DP

Word Break II

Given a string and a dictionary, return all possible sentences that can be formed by segmenting the string.

Medium Graph

Number of Connected Components in an Undirected Graph

Count the number of connected components in a graph.

Medium Array

Find Minimum in Rotated Sorted Array

Find the minimum element in a rotated sorted array.

Medium String

Implement strStr()

Implement the strStr() function to find the first occurrence of a substring in a string.

Hard DP

Longest Increasing Path in a Matrix

Find the length of the longest increasing path in a matrix.

Medium Array

Container With Most Water

Find two lines that together with the x-axis form a container that holds the most water.

Medium String

Minimum Add to Make Parentheses Valid

Given a string of parentheses, find the minimum number of parentheses you need to add to make it valid.

Hard DP

Best Time to Buy and Sell Stock with Cooldown

Find the maximum profit you can achieve with a cooldown period after selling.

Medium Array

Find All Anagrams in a String

Find all start indices of anagrams of a string in another string.

Medium String

Longest Valid Parentheses

Find the length of the longest valid parentheses substring.

Hard DP

Edit Distance

Find the minimum number of operations required to convert one string into another.

Medium Array

Two Sum II - Input Array Is Sorted

Find two numbers such that they add up to a specific target in a sorted array.

Medium String

Count Substrings with All Characters at Least K Times

Count the number of substrings where each character appears at least k times.

Hard DP

Maximum Product of Splitted Binary Tree

Find the maximum product of the sum of two subtrees after splitting a binary tree.

Medium Array

3Sum Closest

Find the sum of three integers that is closest to a target value.

Medium String

Minimum Number of Deletions to Make a String Palindrome

Find the minimum number of deletions required to make a string a palindrome.

Hard DP

Longest Common Substring

Find the length of the longest common substring between two strings.

Medium Array

Find the Duplicate Number

Find the duplicate number in an array containing n + 1 integers where each integer is between 1 and n.

Medium String

Minimum Window Substring II

Find the minimum window substring that contains all characters of another string, allowing duplicates.

Hard DP

Maximum Length of Repeated Subarray II

Find the maximum length of a repeated subarray in two arrays.

Medium Array

Subarray Product Less Than K

Find the number of contiguous subarrays where the product of all elements is less than k.

Medium Array

Find All Numbers Disappeared in an Array

Given an array of integers where 1 ≤ a[i] ≤ n (n = size of array), some elements appear twice and others appear once. Find all the elements of [1, n] inclusive that do not appear in this array.

Medium String

Group Anagrams II

Given an array of strings, group the anagrams together.

Hard DP

Longest Palindromic Substring II

Find the longest palindromic substring in a string, allowing for one character to be removed.

Medium Array

Find the Duplicate Subtree in a Binary Tree

Given a binary tree, find all duplicate subtrees. For each duplicate subtree, return a list of all of its root nodes.

Medium Graph

Course Schedule IV

Determine if you can finish all courses given their prerequisites, and return the order of courses.

Medium String

Minimum Number of Operations to Make a String Palindrome II

Find the minimum number of operations required to make a string a palindrome, allowing for one character to be removed.

Medium Array

Find the Longest Substring with At Most K Distinct Characters

Given a string, find the length of the longest substring that contains at most K distinct characters.

Hard DP

Minimum Cost to Merge Stones II

Find the minimum cost to merge stones into a single pile, allowing for a specific number of merges.

Medium String

Longest Substring with At Most Two Distinct Characters

Find the length of the longest substring that contains at most two distinct characters.

Medium Array

Find the Maximum Length of a Repeated Subarray

Find the maximum length of a subarray that appears in both arrays.

Hard DP

Longest Increasing Subsequence II

Find the length of the longest increasing subsequence in an array, allowing for one character to be removed.

Medium String

Minimum Window Substring III

Find the minimum window substring that contains all characters of another string, allowing for duplicates.

Medium Array

Find the Kth Smallest Element in a Sorted Matrix

Find the Kth smallest element in a sorted matrix.

Hard DP

Minimum Cost to Cut a Stick II

Find the minimum cost to cut a stick into pieces of given lengths, allowing for a specific number of merges.

Medium String

Longest Substring with At Most Three Distinct Characters

Find the length of the longest substring that contains at most three distinct characters.

Medium Array

Find the Maximum Length of a Repeated Subarray II

Find the maximum length of a repeated subarray in two arrays, allowing for one character to be removed.

Hard DP

Longest Palindromic Substring III

Find the longest palindromic substring in a string, allowing for one character to be removed.

Medium String

Minimum Number of Operations to Make a String Palindrome III

Find the minimum number of operations required to make a string a palindrome, allowing for one character to be removed.

Medium Array

Find the Kth Largest Element in a Sorted Matrix II

Find the Kth largest element in a sorted matrix.

Hard DP

Longest Increasing Path in a Matrix II

Find the length of the longest increasing path in a matrix, allowing for one character to be removed.

Medium String

Minimum Window Substring IV

Find the minimum window substring that contains all characters of another string, allowing for duplicates.

Medium Array

Find the Maximum Length of a Repeated Subarray III

Find the maximum length of a repeated subarray in two arrays, allowing for one character to be removed.

Hard DP

Longest Palindromic Substring IV

Find the longest palindromic substring in a string, allowing for one character to be removed.

Medium String

Minimum Number of Operations to Make a String Palindrome IV

Find the minimum number of operations required to make a string a palindrome, allowing for one character to be removed.

Medium Array

Find the Kth Largest Element in a Sorted Matrix III

Find the Kth largest element in a sorted matrix.

Medium Array

Find the Longest Substring with At Most Four Distinct Characters

Given a string, find the length of the longest substring that contains at most four distinct characters.

Medium String

Minimum Number of Operations to Make a String Palindrome V

Find the minimum number of operations required to make a string a palindrome, allowing for two characters to be removed.

Hard DP

Longest Common Subsequence II

Find the length of the longest common subsequence between two strings, allowing for one character to be removed from each string.

Medium Array

Find the Maximum Length of a Repeated Subarray IV

Find the maximum length of a repeated subarray in two arrays, allowing for two characters to be removed.

Medium String

Longest Palindromic Substring V

Find the longest palindromic substring in a string, allowing for two characters to be removed.

Hard DP

Minimum Cost to Cut a Stick III

Find the minimum cost to cut a stick into pieces of given lengths, allowing for two characters to be removed.

Medium Array

Find the Kth Largest Element in a Sorted Matrix IV

Find the Kth largest element in a sorted matrix, allowing for one character to be removed.

Medium String

Minimum Window Substring V

Find the minimum window substring that contains all characters of another string, allowing for two characters to be removed.

Hard DP

Longest Increasing Path in a Matrix III

Find the length of the longest increasing path in a matrix, allowing for two characters to be removed.

Medium Array

Find the Maximum Length of a Repeated Subarray V

Find the maximum length of a repeated subarray in two arrays, allowing for two characters to be removed.

Medium String

Minimum Number of Operations to Make a String Palindrome VI

Find the minimum number of operations required to make a string a palindrome, allowing for three characters to be removed.

Hard DP

Longest Common Subsequence III

Find the length of the longest common subsequence between two strings, allowing for two characters to be removed from each string.

Medium Array

Find the Kth Largest Element in a Sorted Matrix V

Find the Kth largest element in a sorted matrix, allowing for two characters to be removed.

Medium String

Longest Palindromic Substring VI

Find the longest palindromic substring in a string, allowing for three characters to be removed.

Hard DP

Minimum Cost to Cut a Stick IV

Find the minimum cost to cut a stick into pieces of given lengths, allowing for three characters to be removed.

Medium Array

Find the Maximum Length of a Repeated Subarray VI

Find the maximum length of a repeated subarray in two arrays, allowing for three characters to be removed.

Medium String

Minimum Number of Operations to Make a String Palindrome VII

Find the minimum number of operations required to make a string a palindrome, allowing for four characters to be removed.

Hard DP

Longest Common Subsequence IV

Find the length of the longest common subsequence between two strings, allowing for three characters to be removed from each string.

Medium Array

Find the Kth Largest Element in a Sorted Matrix VI

Find the Kth largest element in a sorted matrix, allowing for three characters to be removed.

Medium String

Longest Palindromic Substring VII

Find the longest palindromic substring in a string, allowing for four characters to be removed.

Hard DP

Minimum Cost to Cut a Stick V

Find the minimum cost to cut a stick into pieces of given lengths, allowing for four characters to be removed.

Medium Array

Find the Maximum Length of a Repeated Subarray VII

Find the maximum length of a repeated subarray in two arrays, allowing for four characters to be removed.

Medium String

Minimum Number of Operations to Make a String Palindrome VIII

Find the minimum number of operations required to make a string a palindrome, allowing for five characters to be removed.

Hard DP

Longest Common Subsequence V

Find the length of the longest common subsequence between two strings, allowing for four characters to be removed from each string.

Medium Array

Find the Kth Largest Element in a Sorted Matrix VII

Find the Kth largest element in a sorted matrix, allowing for four characters to be removed.

Medium Array

Find the Longest Substring with At Most Five Distinct Characters

Given a string, find the length of the longest substring that contains at most five distinct characters.

Medium String

Minimum Number of Operations to Make a String Palindrome IX

Find the minimum number of operations required to make a string a palindrome, allowing for five characters to be removed.

Hard DP

Longest Common Subsequence VI

Find the length of the longest common subsequence between two strings, allowing for two characters to be removed from each string.

Medium Array

Find the Maximum Length of a Repeated Subarray VIII

Find the maximum length of a repeated subarray in two arrays, allowing for five characters to be removed.

Medium String

Longest Palindromic Substring X

Find the longest palindromic substring in a string, allowing for five characters to be removed.

Hard DP

Minimum Cost to Cut a Stick VI

Find the minimum cost to cut a stick into pieces of given lengths, allowing for five characters to be removed.

Medium Array

Find the Kth Largest Element in a Sorted Matrix VIII

Find the Kth largest element in a sorted matrix, allowing for five characters to be removed.

Medium String

Minimum Window Substring VI

Find the minimum window substring that contains all characters of another string, allowing for five characters to be removed.

Hard DP

Longest Increasing Path in a Matrix IV

Find the length of the longest increasing path in a matrix, allowing for five characters to be removed.

Medium Array

Find the Maximum Length of a Repeated Subarray IX

Find the maximum length of a repeated subarray in two arrays, allowing for five characters to be removed.

Medium String

Minimum Number of Operations to Make a String Palindrome XI

Find the minimum number of operations required to make a string a palindrome, allowing for six characters to be removed.

Hard DP

Longest Common Subsequence VII

Find the length of the longest common subsequence between two strings, allowing for five characters to be removed from each string.

Medium Array

Find the Kth Largest Element in a Sorted Matrix IX

Find the Kth largest element in a sorted matrix, allowing for six characters to be removed.

Medium String

Longest Palindromic Substring XII

Find the longest palindromic substring in a string, allowing for six characters to be removed.

Hard DP

Minimum Cost to Cut a Stick VII

Find the minimum cost to cut a stick into pieces of given lengths, allowing for six characters to be removed.

Medium Array

Find the Maximum Length of a Repeated Subarray X

Find the maximum length of a repeated subarray in two arrays, allowing for six characters to be removed.

Medium String

Minimum Number of Operations to Make a String Palindrome XII

Find the minimum number of operations required to make a string a palindrome, allowing for seven characters to be removed.

Hard DP

Longest Common Subsequence VIII

Find the length of the longest common subsequence between two strings, allowing for six characters to be removed from each string.

Medium Array

Find the Kth Largest Element in a Sorted Matrix X

Find the Kth largest element in a sorted matrix, allowing for seven characters to be removed.

Medium String

Longest Palindromic Substring XIII

Find the longest palindromic substring in a string, allowing for seven characters to be removed.

Hard DP

Minimum Cost to Cut a Stick VIII

Find the minimum cost to cut a stick into pieces of given lengths, allowing for seven characters to be removed.

Medium Array

Find the Maximum Length of a Repeated Subarray XI

Find the maximum length of a repeated subarray in two arrays, allowing for seven characters to be removed.

Medium String

Minimum Number of Operations to Make a String Palindrome XIII

Find the minimum number of operations required to make a string a palindrome, allowing for eight characters to be removed.

Hard DP

Longest Common Subsequence IX

Find the length of the longest common subsequence between two strings, allowing for seven characters to be removed from each string.

Medium Array

Find the Kth Largest Element in a Sorted Matrix XI

Find the Kth largest element in a sorted matrix, allowing for eight characters to be removed.

Medium Array

Find the Longest Substring with At Most Six Distinct Characters

Given a string, find the length of the longest substring that contains at most six distinct characters.

Medium String

Minimum Number of Operations to Make a String Palindrome XIV

Find the minimum number of operations required to make a string a palindrome, allowing for six characters to be removed.

Hard DP

Longest Common Subsequence X

Find the length of the longest common subsequence between two strings, allowing for three characters to be removed from each string.

Medium Array

Find the Maximum Length of a Repeated Subarray XII

Find the maximum length of a repeated subarray in two arrays, allowing for six characters to be removed.

Medium String

Longest Palindromic Substring XV

Find the longest palindromic substring in a string, allowing for six characters to be removed.

Hard DP

Minimum Cost to Cut a Stick IX

Find the minimum cost to cut a stick into pieces of given lengths, allowing for six characters to be removed.

Medium Array

Find the Kth Largest Element in a Sorted Matrix XII

Find the Kth largest element in a sorted matrix, allowing for six characters to be removed.

Medium String

Minimum Window Substring VII

Find the minimum window substring that contains all characters of another string, allowing for six characters to be removed.

Hard DP

Longest Increasing Path in a Matrix V

Find the length of the longest increasing path in a matrix, allowing for six characters to be removed.

Medium Array

Find the Maximum Length of a Repeated Subarray XIII

Find the maximum length of a repeated subarray in two arrays, allowing for six characters to be removed.

Medium String

Minimum Number of Operations to Make a String Palindrome XV

Find the minimum number of operations required to make a string a palindrome, allowing for seven characters to be removed.

Hard DP

Longest Common Subsequence XI

Find the length of the longest common subsequence between two strings, allowing for six characters to be removed from each string.

Medium Array

Find the Kth Largest Element in a Sorted Matrix XIII

Find the Kth largest element in a sorted matrix, allowing for seven characters to be removed.

Medium String

Longest Palindromic Substring XVI

Find the longest palindromic substring in a string, allowing for seven characters to be removed.

Hard DP

Minimum Cost to Cut a Stick X

Find the minimum cost to cut a stick into pieces of given lengths, allowing for seven characters to be removed.

Medium Array

Find the Maximum Length of a Repeated Subarray XIV

Find the maximum length of a repeated subarray in two arrays, allowing for seven characters to be removed.

Medium String

Minimum Number of Operations to Make a String Palindrome XVI

Find the minimum number of operations required to make a string a palindrome, allowing for eight characters to be removed.

Hard DP

Longest Common Subsequence XII

Find the length of the longest common subsequence between two strings, allowing for seven characters to be removed from each string.

Medium Array

Find the Kth Largest Element in a Sorted Matrix XIV

Find the Kth largest element in a sorted matrix, allowing for eight characters to be removed.

Medium String

Longest Palindromic Substring XVII

Find the longest palindromic substring in a string, allowing for eight characters to be removed.

Hard DP

Minimum Cost to Cut a Stick XI

Find the minimum cost to cut a stick into pieces of given lengths, allowing for eight characters to be removed.

Medium Array

Find the Maximum Length of a Repeated Subarray XV

Find the maximum length of a repeated subarray in two arrays, allowing for eight characters to be removed.

Medium String

Minimum Number of Operations to Make a String Palindrome XVII

Find the minimum number of operations required to make a string a palindrome, allowing for nine characters to be removed.

Hard DP

Longest Common Subsequence XIII

Find the length of the longest common subsequence between two strings, allowing for eight characters to be removed from each string.

Medium Array

Find the Kth Largest Element in a Sorted Matrix XV

Find the Kth largest element in a sorted matrix, allowing for nine characters to be removed.

Easy Array

Find the First Missing Positive

Given an unsorted integer array, find the smallest missing positive integer.

Easy String

Implement strStr() III

Implement strStr() to locate a substring within a string, returning the index of the first occurrence.

Easy Array

Find the Largest Number in an Array

Given an array, find the largest number.

Easy String

Check if a String is a Palindrome II

Given a string, determine if it is a palindrome, considering only alphanumeric characters and ignoring case.

Easy Array

Remove Duplicates from Sorted Array III

Given a sorted array, remove duplicates in-place such that each element appears at most three times.

Easy String

Count Vowels in a String II

Given a string, count the number of vowels in it.

Easy Array

Find the Sum of All Elements in an Array II

Given an array, find the sum of all its elements.

Easy String

Check if Two Strings are Equal

Given two strings, check if they are equal.

Easy Array

Find the Second Smallest Element in an Array

Given an array, find the second smallest element.

Easy String

Reverse a String II

Write a function that reverses a string. The input string is given as an array of characters.

Easy Array

Find the Maximum Difference Between Two Elements

Given an array, find the maximum difference between two elements.

Easy String

Check if a String Contains Only Digits

Given a string, check if it contains only digits.

Easy Array

Find the Average of an Array

Given an array, find the average of its elements.

Easy String

Count the Number of Words in a String

Given a string, count the number of words in it.

Easy Array

Find the Minimum Element in an Array

Given an array, find the minimum element.

Easy String

Check if a String is a Substring of Another II

Given two strings, check if one is a substring of the other.

Easy Array

Find the Mode of an Array

Given an array, find the mode (the value that appears most frequently).

Easy String

Check if a String is a Valid Email

Given a string, check if it is a valid email address.

Easy Array

Find the Unique Element in an Array

Given an array where every element appears twice except for one, find that unique element.

Easy String

Count the Number of Consonants in a String

Given a string, count the number of consonants in it.