Dynamic Programming Problems
Master dynamic programming problems with AI-powered solutions. Get instant coding assistance during your technical interviews for all 381 problems in this category.
Total Problems: 381
Easy: 10
Medium: 193
Hard: 178
Showing 50 of 381 problems
Problems
Scroll within this area to browse all problems
#
Title
Difficulty
Dynamic Programming LeetCode Problems List
- 279. Perfect Squares - Medium - Dynamic ProgrammingGiven an integer n, return the least number of perfect square numbers that sum to n. A perfect square is an integer that is the square of an integer; ... Topics: Math, Dynamic Programming, Breadth-First Search
- 5. Longest Palindromic Substring - Medium - Dynamic ProgrammingGiven a string s, return the longest palindromic substring in s.... Topics: Two Pointers, String, Dynamic Programming
- 118. Pascal's Triangle - Easy - Dynamic ProgrammingGiven an integer numRows, return the first numRows of Pascal's triangle. In Pascal's triangle, each number is the sum of the two numbers directly abov... Topics: Array, Dynamic Programming
- 53. Maximum Subarray - Medium - Dynamic ProgrammingGiven an integer array nums, find the subarray with the largest sum, and return its sum.... Topics: Array, Divide and Conquer, Dynamic Programming
- 300. Longest Increasing Subsequence - Medium - Dynamic ProgrammingGiven an integer array nums, return the length of the longest strictly increasing subsequence.... Topics: Array, Binary Search, Dynamic Programming
- 121. Best Time to Buy and Sell Stock - Easy - Dynamic ProgrammingYou are given an array prices where prices[i] is the price of a given stock on the ith day. You want to maximize your profit by choosing a single day ... Topics: Array, Dynamic Programming
- 1250. Longest Common Subsequence - Medium - Dynamic ProgrammingGiven two strings text1 and text2, return the length of their longest common subsequence. If there is no common subsequence, return 0. A subsequence o... Topics: String, Dynamic Programming
- 322. Coin Change - Medium - Dynamic ProgrammingYou are given an integer array coins representing coins of different denominations and an integer amount representing a total amount of money. Return ... Topics: Array, Dynamic Programming, Breadth-First Search
- 55. Jump Game - Medium - Dynamic ProgrammingYou are given an integer array nums. You are initially positioned at the array's first index, and each element in the array represents your maximum ju... Topics: Array, Dynamic Programming, Greedy
- 152. Maximum Product Subarray - Medium - Dynamic ProgrammingGiven an integer array nums, find a subarray that has the largest product, and return the product. The test cases are generated so that the answer wil... Topics: Array, Dynamic Programming
- 70. Climbing Stairs - Easy - Dynamic ProgrammingYou are climbing a staircase. It takes n steps to reach the top. Each time you can either climb 1 or 2 steps. In how many distinct ways can you climb ... Topics: Math, Dynamic Programming, Memoization
- 42. Trapping Rain Water - Hard - Dynamic ProgrammingGiven 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.... Topics: Array, Two Pointers, Dynamic Programming, Stack, Monotonic Stack
- 803. Cheapest Flights Within K Stops - Medium - Dynamic ProgrammingThere are n cities connected by some number of flights. You are given an array flights where flights[i] = [fromi, toi, pricei] indicates that there is... Topics: Dynamic Programming, Depth-First Search, Breadth-First Search, Graph, Heap (Priority Queue), Shortest Path
- 516. Longest Palindromic Subsequence - Medium - Dynamic ProgrammingGiven a string s, find the longest palindromic subsequence's length in s. A subsequence is a sequence that can be derived from another sequence by del... Topics: String, Dynamic Programming
- 123. Best Time to Buy and Sell Stock III - Hard - Dynamic ProgrammingYou are given an array prices where prices[i] is the price of a given stock on the ith day. Find the maximum profit you can achieve. You may complete ... Topics: Array, Dynamic Programming
- 72. Edit Distance - Medium - Dynamic ProgrammingGiven two strings word1 and word2, return the minimum number of operations required to convert word1 to word2. You have the following three operations... Topics: String, Dynamic Programming
- 1013. Fibonacci Number - Easy - Dynamic ProgrammingThe Fibonacci numbers, commonly denoted F(n) form a sequence, called the Fibonacci sequence, such that each number is the sum of the two preceding one... Topics: Math, Dynamic Programming, Recursion, Memoization
- 124. Binary Tree Maximum Path Sum - Hard - Dynamic ProgrammingA path in a binary tree is a sequence of nodes where each pair of adjacent nodes in the sequence has an edge connecting them. A node can only appear i... Topics: Dynamic Programming, Tree, Depth-First Search, Binary Tree
- 91. Decode Ways - Medium - Dynamic ProgrammingYou have intercepted a secret message encoded as a string of numbers. The message is decoded via the following mapping: "1" -> 'A' "2" -> 'B' ... "25"... Topics: String, Dynamic Programming
- 416. Partition Equal Subset Sum - Medium - Dynamic ProgrammingGiven 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... Topics: Array, Dynamic Programming
- 122. Best Time to Buy and Sell Stock II - Medium - Dynamic ProgrammingYou are given an integer array prices where prices[i] is the price of a given stock on the ith day. On each day, you may decide to buy and/or sell the... Topics: Array, Dynamic Programming, Greedy
- 518. Coin Change II - Medium - Dynamic ProgrammingYou are given an integer array coins representing coins of different denominations and an integer amount representing a total amount of money. Return ... Topics: Array, Dynamic Programming
- 198. House Robber - Medium - Dynamic ProgrammingYou are a professional robber planning to rob houses along a street. Each house has a certain amount of money stashed, the only constraint stopping yo... Topics: Array, Dynamic Programming
- 22. Generate Parentheses - Medium - Dynamic ProgrammingGiven n pairs of parentheses, write a function to generate all combinations of well-formed parentheses.... Topics: String, Dynamic Programming, Backtracking
- 747. Min Cost Climbing Stairs - Easy - Dynamic ProgrammingYou are given an integer array cost where cost[i] is the cost of ith step on a staircase. Once you pay the cost, you can either climb one or two steps... Topics: Array, Dynamic Programming
- 309. Best Time to Buy and Sell Stock with Cooldown - Medium - Dynamic ProgrammingYou are given an array prices where prices[i] is the price of a given stock on the ith day. Find the maximum profit you can achieve. You may complete ... Topics: Array, Dynamic Programming
- 787. Sliding Puzzle - Hard - Dynamic ProgrammingOn an 2 x 3 board, there are five tiles labeled from 1 to 5, and an empty square represented by 0. A move consists of choosing 0 and a 4-directionally... Topics: Array, Dynamic Programming, Backtracking, Breadth-First Search, Memoization, Matrix
- 62. Unique Paths - Medium - Dynamic ProgrammingThere is a robot on an m x n grid. The robot is initially located at the top-left corner (i.e., grid[0][0]). The robot tries to move to the bottom-rig... Topics: Math, Dynamic Programming, Combinatorics
- 1352. Maximum Profit in Job Scheduling - Hard - Dynamic ProgrammingWe have n jobs, where every job is scheduled to be done from startTime[i] to endTime[i], obtaining a profit of profit[i]. You're given the startTime, ... Topics: Array, Binary Search, Dynamic Programming, Sorting
- 741. Cherry Pickup - Hard - Dynamic ProgrammingYou are given an n x n grid representing a field of cherries, each cell is one of three possible integers. 0 means the cell is empty, so you can pass ... Topics: Array, Dynamic Programming, Matrix
- 45. Jump Game II - Medium - Dynamic ProgrammingYou are given a 0-indexed array of integers nums of length n. You are initially positioned at index 0. Each element nums[i] represents the maximum len... Topics: Array, Dynamic Programming, Greedy
- 329. Longest Increasing Path in a Matrix - Hard - Dynamic ProgrammingGiven an m x n integers matrix, return the length of the longest increasing path in matrix. From each cell, you can either move in four directions: le... Topics: Array, Dynamic Programming, Depth-First Search, Breadth-First Search, Graph, Topological Sort, Memoization, Matrix
- 494. Target Sum - Medium - Dynamic ProgrammingYou are given an integer array nums and an integer target. You want to build an expression out of nums by adding one of the symbols '+' and '-' before... Topics: Array, Dynamic Programming, Backtracking
- 32. Longest Valid Parentheses - Hard - Dynamic ProgrammingGiven a string containing just the characters '(' and ')', return the length of the longest valid (well-formed) parentheses substring.... Topics: String, Dynamic Programming, Stack
- 139. Word Break - Medium - Dynamic ProgrammingGiven 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 wor... Topics: Array, Hash Table, String, Dynamic Programming, Trie, Memoization
- 403. Frog Jump - Hard - Dynamic ProgrammingA frog is crossing a river. The river is divided into some number of units, and at each unit, there may or may not exist a stone. The frog can jump on... Topics: Array, Dynamic Programming
- 10. Regular Expression Matching - Hard - Dynamic ProgrammingGiven an input string s and a pattern p, implement regular expression matching with support for '.' and '*' where: '.' Matches any single character.... Topics: String, Dynamic Programming, Recursion
- 119. Pascal's Triangle II - Easy - Dynamic ProgrammingGiven an integer rowIndex, return the rowIndexth (0-indexed) row of the Pascal's triangle. In Pascal's triangle, each number is the sum of the two num... Topics: Array, Dynamic Programming
- 647. Palindromic Substrings - Medium - Dynamic ProgrammingGiven a string s, return the number of palindromic substrings in it. A string is a palindrome when it reads the same backward as forward. A substring ... Topics: Two Pointers, String, Dynamic Programming
- 120. Triangle - Medium - Dynamic ProgrammingGiven a triangle array, return the minimum path sum from top to bottom. For each step, you may move to an adjacent number of the row below. More forma... Topics: Array, Dynamic Programming
- 131. Palindrome Partitioning - Medium - Dynamic ProgrammingGiven a string s, partition s such that every substring of the partition is a palindrome. Return all possible palindrome partitioning of s.... Topics: String, Dynamic Programming, Backtracking
- 97. Interleaving String - Medium - Dynamic ProgrammingGiven strings s1, s2, and s3, find whether s3 is formed by an interleaving of s1 and s2. An interleaving of two strings s and t is a configuration whe... Topics: String, Dynamic Programming
- 96. Unique Binary Search Trees - Medium - Dynamic ProgrammingGiven an integer n, return the number of structurally unique BST's (binary search trees) which has exactly n nodes of unique values from 1 to n.... Topics: Math, Dynamic Programming, Tree, Binary Search Tree, Binary Tree
- 1343. Dice Roll Simulation - Hard - Dynamic ProgrammingA die simulator generates a random number from 1 to 6 for each roll. You introduced a constraint to the generator such that it cannot roll the number ... Topics: Array, Dynamic Programming
- 213. House Robber II - Medium - Dynamic ProgrammingYou are a professional robber planning to rob houses along a street. Each house has a certain amount of money stashed. All houses at this place are ar... Topics: Array, Dynamic Programming
- 673. Number of Longest Increasing Subsequence - Medium - Dynamic ProgrammingGiven an integer array nums, return the number of longest increasing subsequences. Notice that the sequence has to be strictly increasing.... Topics: Array, Dynamic Programming, Binary Indexed Tree, Segment Tree
- 542. 01 Matrix - Medium - Dynamic ProgrammingGiven an m x n binary matrix mat, return the distance of the nearest 0 for each cell. The distance between two cells sharing a common edge is 1.... Topics: Array, Dynamic Programming, Breadth-First Search, Matrix
- 63. Unique Paths II - Medium - Dynamic ProgrammingYou are given an m x n integer array grid. There is a robot initially located at the top-left corner (i.e., grid[0][0]). The robot tries to move to th... Topics: Array, Dynamic Programming, Matrix
- 188. Best Time to Buy and Sell Stock IV - Hard - Dynamic ProgrammingYou are given an integer array prices where prices[i] is the price of a given stock on the ith day, and an integer k. Find the maximum profit you can ... Topics: Array, Dynamic Programming
- 1559. Cherry Pickup II - Hard - Dynamic ProgrammingYou are given a rows x cols matrix grid representing a field of cherries where grid[i][j] represents the number of cherries that you can collect from ... Topics: Array, Dynamic Programming, Matrix
- 174. Dungeon Game - Hard - Dynamic ProgrammingThe demons had captured the princess and imprisoned her in the bottom-right corner of a dungeon. The dungeon consists of m x n rooms laid out in a 2D ... Topics: Array, Dynamic Programming, Matrix
- 909. Stone Game - Medium - Dynamic ProgrammingAlice and Bob play a game with piles of stones. There are an even number of piles arranged in a row, and each pile has a positive integer number of st... Topics: Array, Math, Dynamic Programming, Game Theory
- 140. Word Break II - Hard - Dynamic ProgrammingGiven a string s and a dictionary of strings wordDict, add spaces in s to construct a sentence where each word is a valid dictionary word. Return all ... Topics: Array, Hash Table, String, Dynamic Programming, Backtracking, Trie, Memoization
- 2526. Longest Increasing Subsequence II - Hard - Dynamic ProgrammingYou are given an integer array nums and an integer k. Find the longest subsequence of nums that meets the following requirements: The subsequence is s... Topics: Array, Divide and Conquer, Dynamic Programming, Binary Indexed Tree, Segment Tree, Queue, Monotonic Queue
- 64. Minimum Path Sum - Medium - Dynamic ProgrammingGiven a m x n grid filled with non-negative numbers, find a path from top left to bottom right, which minimizes the sum of all numbers along its path.... Topics: Array, Dynamic Programming, Matrix
- 2444. Longest Ideal Subsequence - Medium - Dynamic ProgrammingYou are given a string s consisting of lowercase letters and an integer k. We call a string t ideal if the following conditions are satisfied: t is a ... Topics: Hash Table, String, Dynamic Programming
- 3892. Best Time to Buy and Sell Stock V - Medium - Dynamic ProgrammingYou are given an integer array prices where prices[i] is the price of a stock in dollars on the ith day, and an integer k. You are allowed to make at ... Topics: Array, Dynamic Programming
- 650. 2 Keys Keyboard - Medium - Dynamic ProgrammingThere is only one character 'A' on the screen of a notepad. You can perform one of two operations on this notepad for each step: Copy All: You can cop... Topics: Math, Dynamic Programming
- 312. Burst Balloons - Hard - Dynamic ProgrammingYou are given n balloons, indexed from 0 to n - 1. Each balloon is painted with a number on it represented by an array nums. You are asked to burst al... Topics: Array, Dynamic Programming
- 2808. Painting the Walls - Hard - Dynamic ProgrammingYou are given two 0-indexed integer arrays, cost and time, of size n representing the costs and the time taken to paint n different walls respectively... Topics: Array, Dynamic Programming
- 923. Super Egg Drop - Hard - Dynamic ProgrammingYou are given k identical eggs and you have access to a building with n floors labeled from 1 to n. You know that there exists a floor f where 0 <= f ... Topics: Math, Binary Search, Dynamic Programming
- 435. Non-overlapping Intervals - Medium - Dynamic ProgrammingGiven an array of intervals intervals where intervals[i] = [starti, endi], return the minimum number of intervals you need to remove to make the rest ... Topics: Array, Dynamic Programming, Greedy, Sorting
- 954. Maximum Sum Circular Subarray - Medium - Dynamic ProgrammingGiven a circular integer array nums of length n, return the maximum possible sum of a non-empty subarray of nums. A circular array means the end of th... Topics: Array, Divide and Conquer, Dynamic Programming, Queue, Monotonic Queue
- 132. Palindrome Partitioning II - Hard - Dynamic ProgrammingGiven a string s, partition s such that every substring of the partition is a palindrome. Return the minimum cuts needed for a palindrome partitioning... Topics: String, Dynamic Programming
- 241. Different Ways to Add Parentheses - Medium - Dynamic ProgrammingGiven a string expression of numbers and operators, return all possible results from computing all the different possible ways to group numbers and op... Topics: Math, String, Dynamic Programming, Recursion, Memoization
- 44. Wildcard Matching - Hard - Dynamic ProgrammingGiven an input string (s) and a pattern (p), implement wildcard pattern matching with support for '?' and '*' where: '?' Matches any single character.... Topics: String, Dynamic Programming, Greedy, Recursion
- 1263. Number of Dice Rolls With Target Sum - Medium - Dynamic ProgrammingYou have n dice, and each dice has k faces numbered from 1 to k. Given three integers n, k, and target, return the number of possible ways (out of the... Topics: Dynamic Programming
- 1814. Jump Game VI - Medium - Dynamic ProgrammingYou are given a 0-indexed integer array nums and an integer k. You are initially standing at index 0. In one move, you can jump at most k steps forwar... Topics: Array, Dynamic Programming, Queue, Heap (Priority Queue), Monotonic Queue
- 377. Combination Sum IV - Medium - Dynamic ProgrammingGiven an array of distinct integers nums and a target integer target, return the number of possible combinations that add up to target. The test cases... Topics: Array, Dynamic Programming
- 678. Valid Parenthesis String - Medium - Dynamic ProgrammingGiven a string s containing only three types of characters: '(', ')' and '*', return true if s is valid. The following rules define a valid string: An... Topics: String, Dynamic Programming, Stack, Greedy
- 410. Split Array Largest Sum - Hard - Dynamic ProgrammingGiven an integer array nums and an integer k, split nums into k non-empty subarrays such that the largest sum of any subarray is minimized. Return the... Topics: Array, Binary Search, Dynamic Programming, Greedy, Prefix Sum
- 1669. Minimum Cost to Cut a Stick - Hard - Dynamic ProgrammingGiven a wooden stick of length n units. The stick is labelled from 0 to n. For example, a stick of length 6 is labelled as follows: Given an integer a... Topics: Array, Dynamic Programming, Sorting
- 3460. Count the Number of Inversions - Hard - Dynamic ProgrammingYou are given an integer n and a 2D array requirements, where requirements[i] = [endi, cnti] represents the end index and the inversion count of each ... Topics: Array, Dynamic Programming
- 2001. Jump Game VII - Medium - Dynamic ProgrammingYou are given a 0-indexed binary string s and two integers minJump and maxJump. In the beginning, you are standing at index 0, which is equal to '0'. ... Topics: String, Dynamic Programming, Sliding Window, Prefix Sum
- 698. Partition to K Equal Sum Subsets - Medium - Dynamic ProgrammingGiven an integer array nums and an integer k, return true if it is possible to divide this array into k non-empty subsets whose sums are all equal.... Topics: Array, Dynamic Programming, Backtracking, Bit Manipulation, Memoization, Bitmask
- 714. Best Time to Buy and Sell Stock with Transaction Fee - Medium - Dynamic ProgrammingYou are given an array prices where prices[i] is the price of a given stock on the ith day, and an integer fee representing a transaction fee. Find th... Topics: Array, Dynamic Programming, Greedy
- 221. Maximal Square - Medium - Dynamic ProgrammingGiven an m x n binary matrix filled with 0's and 1's, find the largest square containing only 1's and return its area.... Topics: Array, Dynamic Programming, Matrix
- 815. Champagne Tower - Medium - Dynamic ProgrammingWe stack glasses in a pyramid, where the first row has 1 glass, the second row has 2 glasses, and so on until the 100th row. Each glass holds one cup... Topics: Dynamic Programming
- 464. Can I Win - Medium - Dynamic ProgrammingIn the "100 game" two players take turns adding, to a running total, any integer from 1 to 10. The player who first causes the running total to reach ... Topics: Math, Dynamic Programming, Bit Manipulation, Memoization, Game Theory, Bitmask
- 1025. Minimum Cost For Tickets - Medium - Dynamic ProgrammingYou have planned some train traveling one year in advance. The days of the year in which you will travel are given as an integer array days. Each day ... Topics: Array, Dynamic Programming
- 638. Shopping Offers - Medium - Dynamic ProgrammingIn LeetCode Store, there are n items to sell. Each item has a price. However, there are some special offers, and a special offer consists of one or mo... Topics: Array, Dynamic Programming, Backtracking, Bit Manipulation, Memoization, Bitmask
- 392. Is Subsequence - Easy - Dynamic ProgrammingGiven two strings s and t, return true if s is a subsequence of t, or false otherwise. A subsequence of a string is a new string that is formed from t... Topics: Two Pointers, String, Dynamic Programming
- 877. Shortest Path Visiting All Nodes - Hard - Dynamic ProgrammingYou have an undirected, connected graph of n nodes labeled from 0 to n - 1. You are given an array graph where graph[i] is a list of all the nodes con... Topics: Dynamic Programming, Bit Manipulation, Breadth-First Search, Graph, Bitmask
- 1170. Shortest Common Supersequence - Hard - Dynamic ProgrammingGiven two strings str1 and str2, return the shortest string that has both str1 and str2 as subsequences. If there are multiple valid strings, return a... Topics: String, Dynamic Programming
- 95. Unique Binary Search Trees II - Medium - Dynamic ProgrammingGiven an integer n, return all the structurally unique BST's (binary search trees), which has exactly n nodes of unique values from 1 to n. Return the... Topics: Dynamic Programming, Backtracking, Tree, Binary Search Tree, Binary Tree
- 1402. Count Square Submatrices with All Ones - Medium - Dynamic ProgrammingGiven a m * n matrix of ones and zeros, return how many square submatrices have all ones.... Topics: Array, Dynamic Programming, Matrix
- 583. Delete Operation for Two Strings - Medium - Dynamic ProgrammingGiven two strings word1 and word2, return the minimum number of steps required to make word1 and word2 the same. In one step, you can delete exactly o... Topics: String, Dynamic Programming
- 1236. N-th Tribonacci Number - Easy - Dynamic ProgrammingThe Tribonacci sequence Tn is defined as follows: T0 = 0, T1 = 1, T2 = 1, and Tn+3 = Tn + Tn+1 + Tn+2 for n >= 0. Given n, return the value of Tn.... Topics: Math, Dynamic Programming, Memoization
- 1130. Last Stone Weight II - Medium - Dynamic ProgrammingYou are given an array of integers stones where stones[i] is the weight of the ith stone. We are playing a game with the stones. On each turn, we choo... Topics: Array, Dynamic Programming
- 1105. Uncrossed Lines - Medium - Dynamic ProgrammingYou are given two integer arrays nums1 and nums2. We write the integers of nums1 and nums2 (in the order they are given) on two separate horizontal li... Topics: Array, Dynamic Programming
- 1586. Longest Subarray of 1's After Deleting One Element - Medium - Dynamic ProgrammingGiven a binary array nums, you should delete one element from it. Return the size of the longest non-empty subarray containing only 1's in the resulti... Topics: Array, Dynamic Programming, Sliding Window
- 1129. Longest String Chain - Medium - Dynamic ProgrammingYou are given an array of words where each word consists of lowercase English letters. wordA is a predecessor of wordB if and only if we can insert ex... Topics: Array, Hash Table, Two Pointers, String, Dynamic Programming, Sorting
- 474. Ones and Zeroes - Medium - Dynamic ProgrammingYou are given an array of binary strings strs and two integers m and n. Return the size of the largest subset of strs such that there are at most m 0'... Topics: Array, String, Dynamic Programming
- 337. House Robber III - Medium - Dynamic ProgrammingThe thief has found himself a new place for his thievery again. There is only one entrance to this area, called root. Besides the root, each house has... Topics: Dynamic Programming, Tree, Depth-First Search, Binary Tree
- 115. Distinct Subsequences - Hard - Dynamic ProgrammingGiven two strings s and t, return the number of distinct subsequences of s which equals t. The test cases are generated so that the answer fits on a 3... Topics: String, Dynamic Programming
- 1825. Find Minimum Time to Finish All Jobs - Hard - Dynamic ProgrammingYou are given an integer array jobs, where jobs[i] is the amount of time it takes to complete the ith job. There are k workers that you can assign job... Topics: Array, Dynamic Programming, Backtracking, Bit Manipulation, Bitmask
- 691. Stickers to Spell Word - Hard - Dynamic ProgrammingWe are given n different types of stickers. Each sticker has a lowercase English word on it. You would like to spell out the given string target by cu... Topics: Array, Hash Table, String, Dynamic Programming, Backtracking, Bit Manipulation, Memoization, Bitmask
- 338. Counting Bits - Easy - Dynamic ProgrammingGiven an integer n, return an array ans of length n + 1 such that for each i (0 <= i <= n), ans[i] is the number of 1's in the binary representation o... Topics: Dynamic Programming, Bit Manipulation
- 1367. Maximum Height by Stacking Cuboids - Hard - Dynamic ProgrammingGiven n cuboids where the dimensions of the ith cuboid is cuboids[i] = [widthi, lengthi, heighti] (0-indexed). Choose a subset of cuboids and place th... Topics: Array, Dynamic Programming, Sorting
- 1240. Stone Game II - Medium - Dynamic ProgrammingAlice and Bob continue their games with piles of stones. There are a number of piles arranged in a row, and each pile has a positive integer number of... Topics: Array, Math, Dynamic Programming, Prefix Sum, Game Theory
- 967. Minimum Falling Path Sum - Medium - Dynamic ProgrammingGiven an n x n array of integers matrix, return the minimum sum of any falling path through matrix. A falling path starts at any element in the first ... Topics: Array, Dynamic Programming, Matrix
- 1117. As Far from Land as Possible - Medium - Dynamic ProgrammingGiven an n x n grid containing only values 0 and 1, where 0 represents water and 1 represents land, find a water cell such that its distance to the ne... Topics: Array, Dynamic Programming, Breadth-First Search, Matrix
- 2690. House Robber IV - Medium - Dynamic ProgrammingThere are several consecutive houses along a street, each of which has some money inside. There is also a robber, who wants to steal money from the ho... Topics: Array, Binary Search, Dynamic Programming, Greedy
- 639. Decode Ways II - Hard - Dynamic ProgrammingA message containing letters from A-Z can be encoded into numbers using the following mapping: 'A' -> "1" 'B' -> "2" ... 'Z' -> "26" To decode an enco... Topics: String, Dynamic Programming
- 3437. Maximum Total Damage With Spell Casting - Medium - Dynamic ProgrammingA magician has various spells. You are given an array power, where each element represents the damage of a spell. Multiple spells can have the same da... Topics: Array, Hash Table, Two Pointers, Binary Search, Dynamic Programming, Sorting, Counting
- 2627. Difference Between Maximum and Minimum Price Sum - Hard - Dynamic ProgrammingThere exists an undirected and initially unrooted tree with n nodes indexed from 0 to n - 1. You are given the integer n and a 2D integer array edges ... Topics: Array, Dynamic Programming, Tree, Depth-First Search
- 1461. Count All Valid Pickup and Delivery Options - Hard - Dynamic ProgrammingGiven n orders, each order consists of a pickup and a delivery service. Count all valid pickup/delivery possible sequences such that delivery(i) is al... Topics: Math, Dynamic Programming, Combinatorics
- 87. Scramble String - Hard - Dynamic ProgrammingWe can scramble a string s to get a string t using the following algorithm: If the length of the string is 1, stop. If the length of the string is > 1... Topics: String, Dynamic Programming
- 375. Guess Number Higher or Lower II - Medium - Dynamic ProgrammingWe are playing the Guessing Game. The game will work as follows: I pick a number between 1 and n. You guess a number. If you guess the right number, y... Topics: Math, Dynamic Programming, Game Theory
- 526. Beautiful Arrangement - Medium - Dynamic ProgrammingSuppose you have n integers labeled 1 through n. A permutation of those n integers perm (1-indexed) is considered a beautiful arrangement if for every... Topics: Array, Dynamic Programming, Backtracking, Bit Manipulation, Bitmask
- 3801. Count Beautiful Numbers - Hard - Dynamic ProgrammingYou are given two positive integers, l and r. A positive integer is called beautiful if the product of its digits is divisible by the sum of its digit... Topics: Dynamic Programming
- 2162. Partition Array Into Two Arrays to Minimize Sum Difference - Hard - Dynamic ProgrammingYou are given an integer array nums of 2 * n integers. You need to partition nums into two arrays of length n to minimize the absolute difference of t... Topics: Array, Two Pointers, Binary Search, Dynamic Programming, Bit Manipulation, Ordered Set, Bitmask
- 2022. Maximum Alternating Subsequence Sum - Medium - Dynamic ProgrammingThe alternating sum of a 0-indexed array is defined as the sum of the elements at even indices minus the sum of the elements at odd indices. For examp... Topics: Array, Dynamic Programming
- 2882. Ways to Express an Integer as Sum of Powers - Medium - Dynamic ProgrammingGiven two positive integers n and x. Return the number of ways n can be expressed as the sum of the xth power of unique positive integers, in other wo... Topics: Dynamic Programming
- 552. Student Attendance Record II - Hard - Dynamic ProgrammingAn attendance record for a student can be represented as a string where each character signifies whether the student was absent, late, or present on t... Topics: Dynamic Programming
- 2078. Maximum Compatibility Score Sum - Medium - Dynamic ProgrammingThere is a survey that consists of n questions where each question's answer is either 0 (no) or 1 (yes). The survey was given to m students numbered f... Topics: Array, Dynamic Programming, Backtracking, Bit Manipulation, Bitmask
- 972. Knight Dialer - Medium - Dynamic ProgrammingThe chess knight has a unique movement, it may move two squares vertically and one square horizontally, or two squares horizontally and one square ver... Topics: Dynamic Programming
- 486. Predict the Winner - Medium - Dynamic ProgrammingYou are given an integer array nums. Two players are playing a game with this array: player 1 and player 2. Player 1 and player 2 take turns, with pla... Topics: Array, Math, Dynamic Programming, Recursion, Game Theory
- 233. Number of Digit One - Hard - Dynamic ProgrammingGiven an integer n, count the total number of digit 1 appearing in all non-negative integers less than or equal to n.... Topics: Math, Dynamic Programming, Recursion
- 357. Count Numbers with Unique Digits - Medium - Dynamic ProgrammingGiven an integer n, return the count of all numbers with unique digits, x, where 0 <= x < 10n.... Topics: Math, Dynamic Programming, Backtracking
- 949. Cat and Mouse - Hard - Dynamic ProgrammingA game on an undirected graph is played by two players, Mouse and Cat, who alternate turns. The graph is given as follows: graph[a] is a list of all n... Topics: Math, Dynamic Programming, Graph, Topological Sort, Memoization, Game Theory
- 1637. String Compression II - Hard - Dynamic ProgrammingRun-length encoding is a string compression method that works by replacing consecutive identical characters (repeated 2 or more times) with the concat... Topics: String, Dynamic Programming
- 934. Bitwise ORs of Subarrays - Medium - Dynamic ProgrammingGiven an integer array arr, return the number of distinct bitwise ORs of all the non-empty subarrays of arr. The bitwise OR of a subarray is the bitwi... Topics: Array, Dynamic Programming, Bit Manipulation
- 3903. Inverse Coin Change - Medium - Dynamic ProgrammingYou are given a 1-indexed integer array numWays, where numWays[i] represents the number of ways to select a total amount i using an infinite supply of... Topics: Array, Dynamic Programming
- 688. Knight Probability in Chessboard - Medium - Dynamic ProgrammingOn an n x n chessboard, a knight starts at the cell (row, column) and attempts to make exactly k moves. The rows and columns are 0-indexed, so the top... Topics: Dynamic Programming
- 1288. Maximum Subarray Sum with One Deletion - Medium - Dynamic ProgrammingGiven an array of integers, return the maximum sum for a non-empty subarray (contiguous elements) with at most one element deletion. In other words, y... Topics: Array, Dynamic Programming
- 977. Distinct Subsequences II - Hard - Dynamic ProgrammingGiven a string s, return the number of distinct non-empty subsequences of s. Since the answer may be very large, return it modulo 109 + 7. A subsequen... Topics: String, Dynamic Programming
- 2348. Count Number of Texts - Medium - Dynamic ProgrammingAlice is texting Bob using her phone. The mapping of digits to letters is shown in the figure below. In order to add a letter, Alice has to press the ... Topics: Hash Table, Math, String, Dynamic Programming
- 1081. Video Stitching - Medium - Dynamic ProgrammingYou are given a series of video clips from a sporting event that lasted time seconds. These video clips can be overlapping with each other and have va... Topics: Array, Dynamic Programming, Greedy
- 646. Maximum Length of Pair Chain - Medium - Dynamic ProgrammingYou are given an array of n pairs pairs where pairs[i] = [lefti, righti] and lefti < righti. A pair p2 = [c, d] follows a pair p1 = [a, b] if b < c. A... Topics: Array, Dynamic Programming, Greedy, Sorting
- 740. Delete and Earn - Medium - Dynamic ProgrammingYou are given an integer array nums. You want to maximize the number of points you get by performing the following operation any number of times: Pick... Topics: Array, Hash Table, Dynamic Programming
- 514. Freedom Trail - Hard - Dynamic ProgrammingIn the video game Fallout 4, the quest "Road to Freedom" requires players to reach a metal dial called the "Freedom Trail Ring" and use the dial to sp... Topics: String, Dynamic Programming, Depth-First Search, Breadth-First Search
- 1437. Minimum Insertion Steps to Make a String Palindrome - Hard - Dynamic ProgrammingGiven a string s. In one step you can insert any character at any index of the string. Return the minimum number of steps to make s palindrome. A Pali... Topics: String, Dynamic Programming
- 2409. Number of Increasing Paths in a Grid - Hard - Dynamic ProgrammingYou are given an m x n integer matrix grid, where you can move from a cell to any adjacent cell in all 4 directions. Return the number of strictly inc... Topics: Array, Dynamic Programming, Depth-First Search, Breadth-First Search, Graph, Topological Sort, Memoization, Matrix
- 473. Matchsticks to Square - Medium - Dynamic ProgrammingYou are given an integer array matchsticks where matchsticks[i] is the length of the ith matchstick. You want to use all the matchsticks to make one s... Topics: Array, Dynamic Programming, Backtracking, Bit Manipulation, Bitmask
- 1587. Parallel Courses II - Hard - Dynamic ProgrammingYou are given an integer n, which indicates that there are n courses labeled from 1 to n. You are also given an array relations where relations[i] = [... Topics: Dynamic Programming, Bit Manipulation, Graph, Bitmask
- 943. Sum of Subarray Minimums - Medium - Dynamic ProgrammingGiven an array of integers arr, find the sum of min(b), where b ranges over every (contiguous) subarray of arr. Since the answer may be large, return ... Topics: Array, Dynamic Programming, Stack, Monotonic Stack
- 1299. K-Concatenation Maximum Sum - Medium - Dynamic ProgrammingGiven an integer array arr and an integer k, modify the array by repeating it k times. For example, if arr = [1, 2] and k = 3 then the modified array ... Topics: Array, Dynamic Programming
- 2118. Maximum Earnings From Taxi - Medium - Dynamic ProgrammingThere are n points on a road you are driving your taxi on. The n points on the road are labeled from 1 to n in the direction you are going, and you wa... Topics: Array, Hash Table, Binary Search, Dynamic Programming, Sorting
- 2757. Count of Integers - Hard - Dynamic ProgrammingYou are given two numeric strings num1 and num2 and two integers max_sum and min_sum. We denote an integer x to be good if: num1 <= x <= num2 min_sum ... Topics: Math, String, Dynamic Programming
- 2061. Painting a Grid With Three Different Colors - Hard - Dynamic ProgrammingYou are given two integers m and n. Consider an m x n grid where each cell is initially white. You can paint each cell red, green, or blue. All cells ... Topics: Dynamic Programming
- 1900. Closest Dessert Cost - Medium - Dynamic ProgrammingYou would like to make dessert and are preparing to buy the ingredients. You have n ice cream base flavors and m types of toppings to choose from. You... Topics: Array, Dynamic Programming, Backtracking
- 3243. Count the Number of Powerful Integers - Hard - Dynamic ProgrammingYou are given three integers start, finish, and limit. You are also given a 0-indexed string s representing a positive integer. A positive integer x i... Topics: Math, String, Dynamic Programming
- 2559. Maximum Number of Non-overlapping Palindrome Substrings - Hard - Dynamic ProgrammingYou are given a string s and a positive integer k. Select a set of non-overlapping substrings from the string s that satisfy the following conditions:... Topics: Two Pointers, String, Dynamic Programming, Greedy
- 836. Race Car - Hard - Dynamic ProgrammingYour car starts at position 0 and speed +1 on an infinite number line. Your car can go into negative positions. Your car drives automatically accordin... Topics: Dynamic Programming
- 466. Count The Repetitions - Hard - Dynamic ProgrammingWe define str = [s, n] as the string str which consists of the string s concatenated n times. For example, str == ["abc", 3] =="abcabcabc". We define ... Topics: String, Dynamic Programming
- 2262. Solving Questions With Brainpower - Medium - Dynamic ProgrammingYou are given a 0-indexed 2D integer array questions where questions[i] = [pointsi, brainpoweri]. The array describes the questions of an exam, where ... Topics: Array, Dynamic Programming
- 2031. Egg Drop With 2 Eggs and N Floors - Medium - Dynamic ProgrammingYou are given two identical eggs and you have access to a building with n floors labeled from 1 to n. You know that there exists a floor f where 0 <= ... Topics: Math, Dynamic Programming
- 2736. Minimum Additions to Make Valid String - Medium - Dynamic ProgrammingGiven a string word to which you can insert letters "a", "b" or "c" anywhere and any number of times, return the minimum number of letters that must b... Topics: String, Dynamic Programming, Stack, Greedy
- 875. Longest Mountain in Array - Medium - Dynamic ProgrammingYou may recall that an array arr is a mountain array if and only if: arr.length >= 3 There exists some index i (0-indexed) with 0 < i < arr.length - 1... Topics: Array, Two Pointers, Dynamic Programming, Enumeration
- 1393. Maximum Value of K Coins From Piles - Hard - Dynamic ProgrammingThere are n piles of coins on a table. Each pile consists of a positive number of coins of assorted denominations. In one move, you can choose any coi... Topics: Array, Dynamic Programming, Prefix Sum
- 1757. Minimum Jumps to Reach Home - Medium - Dynamic ProgrammingA certain bug's home is on the x-axis at position x. Help them get there from position 0. The bug jumps according to the following rules: It can jump ... Topics: Array, Dynamic Programming, Breadth-First Search
- 1628. Count Submatrices With All Ones - Medium - Dynamic ProgrammingGiven an m x n binary matrix mat, return the number of submatrices that have all ones.... Topics: Array, Dynamic Programming, Stack, Matrix, Monotonic Stack
- 1851. Maximum Number of Events That Can Be Attended II - Hard - Dynamic ProgrammingYou are given an array of events where events[i] = [startDayi, endDayi, valuei]. The ith event starts at startDayi and ends at endDayi, and if you att... Topics: Array, Binary Search, Dynamic Programming, Sorting
- 3716. Longest Subsequence With Decreasing Adjacent Difference - Medium - Dynamic ProgrammingYou are given an array of integers nums. Your task is to find the length of the longest subsequence seq of nums, such that the absolute differences be... Topics: Array, Dynamic Programming
- 2067. Maximum Number of Points with Cost - Medium - Dynamic ProgrammingYou are given an m x n integer matrix points (0-indexed). Starting with 0 points, you want to maximize the number of points you can get from the matri... Topics: Array, Dynamic Programming, Matrix
- 3423. Maximum Sum of Subsequence With Non-adjacent Elements - Hard - Dynamic ProgrammingYou are given an array nums consisting of integers. You are also given a 2D array queries, where queries[i] = [posi, xi]. For query i, we first set nu... Topics: Array, Divide and Conquer, Dynamic Programming, Segment Tree
- 2521. Paths in Matrix Whose Sum Is Divisible by K - Hard - Dynamic ProgrammingYou are given a 0-indexed m x n integer matrix grid and an integer k. You are currently at position (0, 0) and you want to reach position (m - 1, n - ... Topics: Array, Dynamic Programming, Matrix
- 1871. Palindrome Partitioning IV - Hard - Dynamic ProgrammingGiven a string s, return true if it is possible to split the string s into three non-empty palindromic substrings. Otherwise, return false. A str... Topics: String, Dynamic Programming
- 1583. Paint House III - Hard - Dynamic ProgrammingThere is a row of m houses in a small city, each house must be painted with one of the n colors (labeled from 1 to n), some houses that have been pain... Topics: Array, Dynamic Programming
- 488. Zuma Game - Hard - Dynamic ProgrammingYou are playing a variation of the game Zuma. In this variation of Zuma, there is a single row of colored balls on a board, where each ball can be col... Topics: String, Dynamic Programming, Stack, Breadth-First Search, Memoization
- 2397. Count Number of Ways to Place Houses - Medium - Dynamic ProgrammingThere is a street with n * 2 plots, where there are n plots on each side of the street. The plots on each side are numbered from 1 to n. On each plot,... Topics: Dynamic Programming
- 2147. The Score of Students Solving Math Expression - Hard - Dynamic ProgrammingYou are given a string s that contains digits 0-9, addition symbols '+', and multiplication symbols '*' only, representing a valid math expression of ... Topics: Array, Hash Table, Math, String, Dynamic Programming, Stack, Memoization
- 3795. Zero Array Transformation IV - Medium - Dynamic ProgrammingYou are given an integer array nums of length n and a 2D array queries, where queries[i] = [li, ri, vali]. Each queries[i] represents the following ac... Topics: Array, Dynamic Programming
- 1522. Stone Game III - Hard - Dynamic ProgrammingAlice and Bob continue their games with piles of stones. There are several stones arranged in a row, and each stone has an associated value which is a... Topics: Array, Math, Dynamic Programming, Game Theory
- 930. All Possible Full Binary Trees - Medium - Dynamic ProgrammingGiven an integer n, return a list of all possible full binary trees with n nodes. Each node of each tree in the answer must have Node.val == 0. Each e... Topics: Dynamic Programming, Tree, Recursion, Memoization, Binary Tree
- 1224. Minimum Falling Path Sum II - Hard - Dynamic ProgrammingGiven an n x n integer matrix grid, return the minimum sum of a falling path with non-zero shifts. A falling path with non-zero shifts is a choice of ... Topics: Array, Dynamic Programming, Matrix
- 3919. Network Recovery Pathways - Hard - Dynamic ProgrammingYou are given a directed acyclic graph of n nodes numbered from 0 to n − 1. This is represented by a 2D array edges of length m, where edges[i] = [ui,... Topics: Array, Binary Search, Dynamic Programming, Graph, Topological Sort, Heap (Priority Queue), Shortest Path
- 1555. Number of Ways of Cutting a Pizza - Hard - Dynamic ProgrammingGiven a rectangular pizza represented as a rows x cols matrix containing the following characters: 'A' (an apple) and '.' (empty cell) and given the i... Topics: Array, Dynamic Programming, Memoization, Matrix, Prefix Sum
- 2648. Number of Ways to Earn Points - Hard - Dynamic ProgrammingThere is a test that has n types of questions. You are given an integer target and a 0-indexed 2D integer array types where types[i] = [counti, marksi... Topics: Array, Dynamic Programming
- 1631. Number of Sub-arrays With Odd Sum - Medium - Dynamic ProgrammingGiven an array of integers arr, return the number of subarrays with an odd sum. Since the answer can be very large, return it modulo 109 + 7.... Topics: Array, Math, Dynamic Programming, Prefix Sum
- 1196. Filling Bookcase Shelves - Medium - Dynamic ProgrammingYou are given an array books where books[i] = [thicknessi, heighti] indicates the thickness and height of the ith book. You are also given an integer ... Topics: Array, Dynamic Programming
- 354. Russian Doll Envelopes - Hard - Dynamic ProgrammingYou are given a 2D array of integers envelopes where envelopes[i] = [wi, hi] represents the width and the height of an envelope. One envelope can fit ... Topics: Array, Binary Search, Dynamic Programming, Sorting
- 1849. Maximum Absolute Sum of Any Subarray - Medium - Dynamic ProgrammingYou are given an integer array nums. The absolute sum of a subarray [numsl, numsl+1, ..., numsr-1, numsr] is abs(numsl + numsl+1 + ... + numsr-1 + num... Topics: Array, Dynamic Programming
- 3854. Maximum Profit from Trading Stocks with Discounts - Hard - Dynamic ProgrammingYou are given an integer n, representing the number of employees in a company. Each employee is assigned a unique ID from 1 to n, and employee 1 is th... Topics: Array, Dynamic Programming, Tree, Depth-First Search
- 1456. Find the City With the Smallest Number of Neighbors at a Threshold Distance - Medium - Dynamic ProgrammingThere are n cities numbered from 0 to n-1. Given the array edges where edges[i] = [fromi, toi, weighti] represents a bidirectional and weighted edge b... Topics: Dynamic Programming, Graph, Shortest Path
- 2755. Extra Characters in a String - Medium - Dynamic ProgrammingYou are given a 0-indexed string s and a dictionary of words dictionary. You have to break s into one or more non-overlapping substrings such that eac... Topics: Array, Hash Table, String, Dynamic Programming, Trie
- 718. Maximum Length of Repeated Subarray - Medium - Dynamic ProgrammingGiven two integer arrays nums1 and nums2, return the maximum length of a subarray that appears in both arrays.... Topics: Array, Binary Search, Dynamic Programming, Sliding Window, Rolling Hash, Hash Function
- 826. Soup Servings - Medium - Dynamic ProgrammingYou have two soups, A and B, each starting with n mL. On every turn, one of the following four serving operations is chosen at random, each with proba... Topics: Math, Dynamic Programming, Probability and Statistics
- 2633. Minimum Cost to Split an Array - Hard - Dynamic ProgrammingYou are given an integer array nums and an integer k. Split the array into some number of non-empty subarrays. The cost of a split is the sum of the i... Topics: Array, Hash Table, Dynamic Programming, Counting
- 1471. Maximum Students Taking Exam - Hard - Dynamic ProgrammingGiven a m * n matrix seats that represent seats distributions in a classroom. If a seat is broken, it is denoted by '#' character otherwise it is den... Topics: Array, Dynamic Programming, Bit Manipulation, Matrix, Bitmask
- 806. Domino and Tromino Tiling - Medium - Dynamic ProgrammingYou have two types of tiles: a 2 x 1 domino shape and a tromino shape. You may rotate these shapes. Given an integer n, return the number of ways to t... Topics: Dynamic Programming
- 1121. Partition Array for Maximum Sum - Medium - Dynamic ProgrammingGiven an integer array arr, partition the array into (contiguous) subarrays of length at most k. After partitioning, each subarray has their values ch... Topics: Array, Dynamic Programming
- 3491. Find the Maximum Length of Valid Subsequence II - Medium - Dynamic ProgrammingYou are given an integer array nums and a positive integer k. A subsequence sub of nums with length x is called valid if it satisfies: (sub[0] + sub[1... Topics: Array, Dynamic Programming
- 3948. Maximum Number of Subsequences After One Inserting - Medium - Dynamic ProgrammingYou are given a string s consisting of uppercase English letters. You are allowed to insert at most one uppercase English letter at any position (incl... Topics: String, Dynamic Programming, Greedy, Prefix Sum
- 1063. Best Sightseeing Pair - Medium - Dynamic ProgrammingYou are given an integer array values where values[i] represents the value of the ith sightseeing spot. Two sightseeing spots i and j have a distance ... Topics: Array, Dynamic Programming
- 712. Minimum ASCII Delete Sum for Two Strings - Medium - Dynamic ProgrammingGiven two strings s1 and s2, return the lowest ASCII sum of deleted characters to make two strings equal.... Topics: String, Dynamic Programming
- 3909. Minimum Increments to Equalize Leaf Paths - Medium - Dynamic ProgrammingYou are given an integer n and an undirected tree rooted at node 0 with n nodes numbered from 0 to n - 1. This is represented by a 2D array edges of l... Topics: Array, Dynamic Programming, Tree, Depth-First Search
- 1531. Number of Ways to Wear Different Hats to Each Other - Hard - Dynamic ProgrammingThere are n people and 40 types of hats labeled from 1 to 40. Given a 2D integer array hats, where hats[i] is a list of all hats preferred by the ith ... Topics: Array, Dynamic Programming, Bit Manipulation, Bitmask
- 3525. Maximum Energy Boost From Two Drinks - Medium - Dynamic ProgrammingYou are given two integer arrays energyDrinkA and energyDrinkB of the same length n by a futuristic sports scientist. These arrays represent the energ... Topics: Array, Dynamic Programming
- 2601. Number of Great Partitions - Hard - Dynamic ProgrammingYou are given an array nums consisting of positive integers and an integer k. Partition the array into two ordered groups such that each element is in... Topics: Array, Dynamic Programming
- 2090. Number of Ways to Arrive at Destination - Medium - Dynamic ProgrammingYou are in a city that consists of n intersections numbered from 0 to n - 1 with bi-directional roads between some intersections. The inputs are gener... Topics: Dynamic Programming, Graph, Topological Sort, Shortest Path
- 1573. Find Two Non-overlapping Sub-arrays Each With Target Sum - Medium - Dynamic ProgrammingYou are given an array of integers arr and an integer target. You have to find two non-overlapping sub-arrays of arr each with a sum equal target. The... Topics: Array, Hash Table, Binary Search, Dynamic Programming, Sliding Window
- 3649. Minimum Time to Break Locks I - Medium - Dynamic ProgrammingBob is stuck in a dungeon and must break n locks, each requiring some amount of energy to break. The required energy for each lock is stored in an arr... Topics: Array, Dynamic Programming, Backtracking, Bit Manipulation, Depth-First Search, Bitmask
- 1457. Minimum Difficulty of a Job Schedule - Hard - Dynamic ProgrammingYou want to schedule a list of jobs in d days. Jobs are dependent (i.e To work on the ith job, you have to finish all the jobs j where 0 <= j < i). Yo... Topics: Array, Dynamic Programming
- 1042. Minimum Cost to Merge Stones - Hard - Dynamic ProgrammingThere are n piles of stones arranged in a row. The ith pile has stones[i] stones. A move consists of merging exactly k consecutive piles into one pile... Topics: Array, Dynamic Programming, Prefix Sum
- 2267. Minimum Difference in Sums After Removal of Elements - Hard - Dynamic ProgrammingYou are given a 0-indexed integer array nums consisting of 3 * n elements. You are allowed to remove any subsequence of elements of size exactly n fro... Topics: Array, Dynamic Programming, Heap (Priority Queue)
- 3630. Total Characters in String After Transformations II - Hard - Dynamic ProgrammingYou are given a string s consisting of lowercase English letters, an integer t representing the number of transformations to perform, and an array num... Topics: Hash Table, Math, String, Dynamic Programming, Counting
- 3913. Partition Array to Minimize XOR - Medium - Dynamic ProgrammingYou are given an integer array nums and an integer k. Your task is to partition nums into k non-empty subarrays. For each subarray, compute the bitwis... Topics: Array, Dynamic Programming, Bit Manipulation, Prefix Sum
- 1744. Number of Ways to Form a Target String Given a Dictionary - Hard - Dynamic ProgrammingYou are given a list of strings of the same length words and a string target. Your task is to form target using the given words under the following ru... Topics: Array, String, Dynamic Programming
- 1290. Make Array Strictly Increasing - Hard - Dynamic ProgrammingGiven two integer arrays arr1 and arr2, return the minimum number of operations (possibly zero) needed to make arr1 strictly increasing. In one operat... Topics: Array, Binary Search, Dynamic Programming, Sorting
- 2867. Ways to Split Array Into Good Subarrays - Medium - Dynamic ProgrammingYou are given a binary array nums. A subarray of an array is good if it contains exactly one element with the value 1. Return an integer denoting the ... Topics: Array, Math, Dynamic Programming
- 3106. Length of the Longest Subsequence That Sums to Target - Medium - Dynamic ProgrammingYou are given a 0-indexed array of integers nums, and an integer target. Return the length of the longest subsequence of nums that sums up to target. ... Topics: Array, Dynamic Programming
- 1057. Numbers With Repeated Digits - Hard - Dynamic ProgrammingGiven an integer n, return the number of positive integers in the range [1, n] that have at least one repeated digit.... Topics: Math, Dynamic Programming
- 1732. Minimum One Bit Operations to Make Integers Zero - Hard - Dynamic ProgrammingGiven an integer n, you must transform it into 0 using the following operations any number of times: Change the rightmost (0th) bit in the binary repr... Topics: Dynamic Programming, Bit Manipulation, Memoization
- 546. Remove Boxes - Hard - Dynamic ProgrammingYou are given several boxes with different colors represented by different positive numbers. You may experience several rounds to remove boxes until t... Topics: Array, Dynamic Programming, Memoization
- 2979. Maximize the Profit as the Salesman - Medium - Dynamic ProgrammingYou are given an integer n representing the number of houses on a number line, numbered from 0 to n - 1. Additionally, you are given a 2D integer arra... Topics: Array, Hash Table, Binary Search, Dynamic Programming, Sorting
- 3930. Longest Palindromic Path in Graph - Hard - Dynamic ProgrammingYou are given an integer n and an undirected graph with n nodes labeled from 0 to n - 1 and a 2D array edges, where edges[i] = [ui, vi] indicates an e... Topics: String, Dynamic Programming, Bit Manipulation, Graph, Bitmask
- 1086. Divisor Game - Easy - Dynamic ProgrammingAlice and Bob take turns playing a game, with Alice starting first. Initially, there is a number n on the chalkboard. On each player's turn, that play... Topics: Math, Dynamic Programming, Brainteaser, Game Theory
- 3494. Minimum Cost for Cutting Cake I - Medium - Dynamic ProgrammingThere is an m x n cake that needs to be cut into 1 x 1 pieces. You are given integers m, n, and two arrays: horizontalCut of size m - 1, where horizon... Topics: Array, Dynamic Programming, Greedy, Sorting
- 1952. Minimum Sideway Jumps - Medium - Dynamic ProgrammingThere is a 3 lane road of length n that consists of n + 1 points labeled from 0 to n. A frog starts at point 0 in the second lane and wants to jump to... Topics: Array, Dynamic Programming, Greedy
- 1451. Minimum Number of Taps to Open to Water a Garden - Hard - Dynamic ProgrammingThere is a one-dimensional garden on the x-axis. The garden starts at the point 0 and ends at the point n. (i.e., the length of the garden is n). Ther... Topics: Array, Dynamic Programming, Greedy
- 1008. Binary Tree Cameras - Hard - Dynamic ProgrammingYou are given the root of a binary tree. We install cameras on the tree nodes where each camera at a node can monitor its parent, itself, and its imme... Topics: Dynamic Programming, Tree, Depth-First Search, Binary Tree
- 3937. Number of Integers With Popcount-Depth Equal to K I - Hard - Dynamic ProgrammingYou are given two integers n and k. For any positive integer x, define the following sequence: p0 = x pi+1 = popcount(pi) for all i >= 0, where popcou... Topics: Math, Dynamic Programming, Combinatorics
- 489. Kth Smallest Instructions - Hard - Dynamic ProgrammingBob is standing at cell (0, 0), and he wants to reach destination: (row, column). He can only travel right and down. You are going to help Bob by prov... Topics: Array, Math, Dynamic Programming, Combinatorics
- 1700. Minimum Time to Make Rope Colorful - Medium - Dynamic ProgrammingAlice has n balloons arranged on a rope. You are given a 0-indexed string colors where colors[i] is the color of the ith balloon. Alice wants the rope... Topics: Array, String, Dynamic Programming, Greedy
- 2108. Minimize the Difference Between Target and Chosen Elements - Medium - Dynamic ProgrammingYou are given an m x n integer matrix mat and an integer target. Choose one integer from each row in the matrix such that the absolute difference betw... Topics: Array, Dynamic Programming, Matrix
- 3701. Minimum Cost Good Caption - Hard - Dynamic ProgrammingYou are given a string caption of length n. A good caption is a string where every character appears in groups of at least 3 consecutive occurrences. ... Topics: String, Dynamic Programming
- 3414. Find Number of Ways to Reach the K-th Stair - Hard - Dynamic ProgrammingYou are given a non-negative integer k. There exists a staircase with an infinite number of stairs, with the lowest stair numbered 0. Alice has an int... Topics: Math, Dynamic Programming, Bit Manipulation, Memoization, Combinatorics
- 2395. Longest Binary Subsequence Less Than or Equal to K - Medium - Dynamic ProgrammingYou are given a binary string s and a positive integer k. Return the length of the longest subsequence of s that makes up a binary number less than or... Topics: String, Dynamic Programming, Greedy, Memoization
- 1986. Largest Color Value in a Directed Graph - Hard - Dynamic ProgrammingThere is a directed graph of n colored nodes and m edges. The nodes are numbered from 0 to n - 1. You are given a string colors where colors[i] is a l... Topics: Hash Table, Dynamic Programming, Graph, Topological Sort, Memoization, Counting
- 85. Maximal Rectangle - Hard - Dynamic ProgrammingGiven a rows x cols binary matrix filled with 0's and 1's, find the largest rectangle containing only 1's and return its area.... Topics: Array, Dynamic Programming, Stack, Matrix, Monotonic Stack
- 1766. Minimum Number of Removals to Make Mountain Array - Hard - Dynamic ProgrammingYou may recall that an array arr is a mountain array if and only if: arr.length >= 3 There exists some index i (0-indexed) with 0 < i < arr.length - 1... Topics: Array, Binary Search, Dynamic Programming, Greedy
- 1038. Number of Squareful Arrays - Hard - Dynamic ProgrammingAn array is squareful if the sum of every pair of adjacent elements is a perfect square. Given an integer array nums, return the number of permutation... Topics: Array, Hash Table, Math, Dynamic Programming, Backtracking, Bit Manipulation, Bitmask
- 3786. Longest Palindromic Subsequence After at Most K Operations - Medium - Dynamic ProgrammingYou are given a string s and an integer k. In one operation, you can replace the character at any position with the next or previous letter in the alp... Topics: String, Dynamic Programming
- 3552. Find the Largest Palindrome Divisible by K - Hard - Dynamic ProgrammingYou are given two positive integers n and k. An integer x is called k-palindromic if: x is a palindrome. x is divisible by k. Return the largest integ... Topics: Math, String, Dynamic Programming, Greedy, Number Theory
- 1633. Minimum Number of Increments on Subarrays to Form a Target Array - Hard - Dynamic ProgrammingYou are given an integer array target. You have an integer array initial of the same size as target with all elements initially zeros. In one operatio... Topics: Array, Dynamic Programming, Stack, Greedy, Monotonic Stack
- 1376. Selling Pieces of Wood - Hard - Dynamic ProgrammingYou are given two integers m and n that represent the height and width of a rectangular piece of wood. You are also given a 2D integer array prices, w... Topics: Array, Dynamic Programming, Memoization
- 3024. String Transformation - Hard - Dynamic ProgrammingYou are given two strings s and t of equal length n. You can perform the following operation on the string s: Remove a suffix of s of length l where 0... Topics: Math, String, Dynamic Programming, String Matching
- 3697. Minimum Increments for Target Multiples in an Array - Hard - Dynamic ProgrammingYou are given two arrays, nums and target. In a single operation, you may increment any element of nums by 1. Return the minimum number of operations ... Topics: Array, Math, Dynamic Programming, Bit Manipulation, Number Theory, Bitmask
- 1466. Jump Game V - Hard - Dynamic ProgrammingGiven an array of integers arr and an integer d. In one step you can jump from index i to index: i + x where: i + x < arr.length and 0 < x <= d. i - ... Topics: Array, Dynamic Programming, Sorting
- 3776. Find Minimum Cost to Remove Array Elements - Medium - Dynamic ProgrammingYou are given an integer array nums. Your task is to remove all elements from the array by performing one of the following operations at each step unt... Topics: Array, Dynamic Programming
- 2040. Minimum Cost to Reach Destination in Time - Hard - Dynamic ProgrammingThere is a country of n cities numbered from 0 to n - 1 where all the cities are connected by bi-directional roads. The roads are represented as a 2D ... Topics: Array, Dynamic Programming, Graph
- 1725. Number of Sets of K Non-Overlapping Line Segments - Medium - Dynamic ProgrammingGiven n points on a 1-D plane, where the ith point (from 0 to n-1) is at x = i, find the number of ways we can draw exactly k non-overlapping line seg... Topics: Math, Dynamic Programming, Combinatorics
- 2114. Minimum Number of Work Sessions to Finish the Tasks - Medium - Dynamic ProgrammingThere are n tasks assigned to you. The task times are represented as an integer array tasks of length n, where the ith task takes tasks[i] hours to fi... Topics: Array, Dynamic Programming, Backtracking, Bit Manipulation, Bitmask
- 1017. Odd Even Jump - Hard - Dynamic ProgrammingYou are given an integer array arr. From some starting index, you can make a series of jumps. The (1st, 3rd, 5th, ...) jumps in the series are called ... Topics: Array, Dynamic Programming, Stack, Sorting, Monotonic Stack, Ordered Set
- 3677. Maximum Amount of Money Robot Can Earn - Medium - Dynamic ProgrammingYou are given an m x n grid. A robot starts at the top-left corner of the grid (0, 0) and wants to reach the bottom-right corner (m - 1, n - 1). The r... Topics: Array, Dynamic Programming, Matrix
- 1690. Maximum Length of Subarray With Positive Product - Medium - Dynamic ProgrammingGiven an array of integers nums, find the maximum length of a subarray where the product of all its elements is positive. A subarray of an array is a ... Topics: Array, Dynamic Programming, Greedy
- 863. Sum of Distances in Tree - Hard - Dynamic ProgrammingThere is an undirected connected tree with n nodes labeled from 0 to n - 1 and n - 1 edges. You are given the integer n and the array edges where edge... Topics: Dynamic Programming, Tree, Depth-First Search, Graph
- 3105. Minimum Edge Reversals So Every Node Is Reachable - Hard - Dynamic ProgrammingThere is a simple directed graph with n nodes labeled from 0 to n - 1. The graph would form a tree if its edges were bi-directional. You are given an ... Topics: Dynamic Programming, Depth-First Search, Breadth-First Search, Graph
- 902. Minimum Number of Refueling Stops - Hard - Dynamic ProgrammingA car travels from a starting position to a destination which is target miles east of the starting position. There are gas stations along the way. The... Topics: Array, Dynamic Programming, Greedy, Heap (Priority Queue)
- 1545. Form Largest Integer With Digits That Add up to Target - Hard - Dynamic ProgrammingGiven an array of integers cost and an integer target, return the maximum integer you can paint under the following rules: The cost of painting a digi... Topics: Array, Dynamic Programming
- 3900. Find Weighted Median Node in Tree - Hard - Dynamic ProgrammingYou are given an integer n and an undirected, weighted tree rooted at node 0 with n nodes numbered from 0 to n - 1. This is represented by a 2D array ... Topics: Array, Binary Search, Dynamic Programming, Tree, Depth-First Search
- 2205. Find Good Days to Rob the Bank - Medium - Dynamic ProgrammingYou and a gang of thieves are planning on robbing a bank. You are given a 0-indexed integer array security, where security[i] is the number of guards ... Topics: Array, Dynamic Programming, Prefix Sum
- 3139. Subarrays Distinct Element Sum of Squares II - Hard - Dynamic ProgrammingYou are given a 0-indexed integer array nums. The distinct count of a subarray of nums is defined as: Let nums[i..j] be a subarray of nums consisting ... Topics: Array, Dynamic Programming, Binary Indexed Tree, Segment Tree
- 264. Ugly Number II - Medium - Dynamic ProgrammingAn ugly number is a positive integer whose prime factors are limited to 2, 3, and 5. Given an integer n, return the nth ugly number.... Topics: Hash Table, Math, Dynamic Programming, Heap (Priority Queue)
- 1727. Cat and Mouse II - Hard - Dynamic ProgrammingA game is played by a cat and a mouse named Cat and Mouse. The environment is represented by a grid of size rows x cols, where each element is a wall,... Topics: Array, Math, Dynamic Programming, Graph, Topological Sort, Memoization, Matrix, Game Theory
- 1808. Stone Game VII - Medium - Dynamic ProgrammingAlice and Bob take turns playing a game, with Alice starting first. There are n stones arranged in a row. On each player's turn, they can remove eithe... Topics: Array, Math, Dynamic Programming, Game Theory
- 3562. Maximum Score of Non-overlapping Intervals - Hard - Dynamic ProgrammingYou are given a 2D integer array intervals, where intervals[i] = [li, ri, weighti]. Interval i starts at position li and ends at ri, and has a weight ... Topics: Array, Binary Search, Dynamic Programming, Sorting
- 2754. Maximum Strength of a Group - Medium - Dynamic ProgrammingYou are given a 0-indexed integer array nums representing the score of students in an exam. The teacher would like to form one non-empty group of stud... Topics: Array, Dynamic Programming, Backtracking, Greedy, Bit Manipulation, Sorting, Enumeration
- 2708. Find the String with LCP - Hard - Dynamic ProgrammingWe define the lcp matrix of any 0-indexed string word of n lowercase English letters as an n x n grid such that: lcp[i][j] is equal to the length of t... Topics: Array, String, Dynamic Programming, Greedy, Union Find, Matrix
- 1111. Minimum Score Triangulation of Polygon - Medium - Dynamic ProgrammingYou have a convex n-sided polygon where each vertex has an integer value. You are given an integer array values where values[i] is the value of the it... Topics: Array, Dynamic Programming
- 1716. Maximum Non Negative Product in a Matrix - Medium - Dynamic ProgrammingYou are given a m x n matrix grid. Initially, you are located at the top-left corner (0, 0), and in each step, you can only move right or down in the ... Topics: Array, Dynamic Programming, Matrix
- 3688. Maximize Subarray Sum After Removing All Occurrences of One Element - Hard - Dynamic ProgrammingYou are given an integer array nums. You can do the following operation on the array at most once: Choose any integer x such that nums remains non-emp... Topics: Array, Dynamic Programming, Segment Tree
- 2251. Number of Ways to Divide a Long Corridor - Hard - Dynamic ProgrammingAlong a long library corridor, there is a line of seats and decorative plants. You are given a 0-indexed string corridor of length n consisting of let... Topics: Math, String, Dynamic Programming
- 3391. Maximum Difference Score in a Grid - Medium - Dynamic ProgrammingYou are given an m x n matrix grid consisting of positive integers. You can move from a cell in the matrix to any other cell that is either to the bot... Topics: Array, Dynamic Programming, Matrix
- 2131. Smallest Missing Genetic Value in Each Subtree - Hard - Dynamic ProgrammingThere is a family tree rooted at 0 consisting of n nodes numbered 0 to n - 1. You are given a 0-indexed integer array parents, where parents[i] is the... Topics: Dynamic Programming, Tree, Depth-First Search, Union Find
- 2404. Number of Distinct Roll Sequences - Hard - Dynamic ProgrammingYou are given an integer n. You roll a fair 6-sided dice n times. Determine the total number of distinct sequences of rolls possible such that the fol... Topics: Dynamic Programming, Memoization
- 1913. Make the XOR of All Segments Equal to Zero - Hard - Dynamic ProgrammingYou are given an array nums and an integer k. The XOR of a segment [left, right] where left <= right is the XOR of all the elements with indic... Topics: Array, Dynamic Programming, Bit Manipulation
- 2176. Parallel Courses III - Hard - Dynamic ProgrammingYou are given an integer n, which indicates that there are n courses labeled from 1 to n. You are also given a 2D integer array relations where relati... Topics: Array, Dynamic Programming, Graph, Topological Sort
- 2184. Check if an Original String Exists Given Two Encoded Strings - Hard - Dynamic ProgrammingAn original string, consisting of lowercase English letters, can be encoded by the following steps: Arbitrarily split it into a sequence of some numbe... Topics: String, Dynamic Programming
- 3456. Find the Maximum Length of a Good Subsequence I - Medium - Dynamic ProgrammingYou are given an integer array nums and a non-negative integer k. A sequence of integers seq is called good if there are at most k indices i in the ra... Topics: Array, Hash Table, Dynamic Programming
- 1511. Count Number of Teams - Medium - Dynamic ProgrammingThere are n soldiers standing in a line. Each soldier is assigned a unique rating value. You have to form a team of 3 soldiers amongst them under the ... Topics: Array, Dynamic Programming, Binary Indexed Tree, Segment Tree
- 3345. Find the Sum of the Power of All Subsequences - Hard - Dynamic ProgrammingYou are given an integer array nums of length n and a positive integer k. The power of an array of integers is defined as the number of subsequences w... Topics: Array, Dynamic Programming
- 3406. Find All Possible Stable Binary Arrays I - Medium - Dynamic ProgrammingYou are given 3 positive integers zero, one, and limit. A binary array arr is called stable if: The number of occurrences of 0 in arr is exactly zero.... Topics: Dynamic Programming, Prefix Sum
- 1020. Longest Turbulent Subarray - Medium - Dynamic ProgrammingGiven an integer array arr, return the length of a maximum size turbulent subarray of arr. A subarray is turbulent if the comparison sign flips betwee... Topics: Array, Dynamic Programming, Sliding Window
- 2002. Stone Game VIII - Hard - Dynamic ProgrammingAlice and Bob take turns playing a game, with Alice starting first. There are n stones arranged in a row. On each player's turn, while the number of s... Topics: Array, Math, Dynamic Programming, Prefix Sum, Game Theory
- 3866. Minimum Steps to Convert String with Operations - Hard - Dynamic ProgrammingYou are given two strings, word1 and word2, of equal length. You need to transform word1 into word2. For this, divide word1 into one or more contiguou... Topics: String, Dynamic Programming, Greedy
- 3875. Maximum Good Subtree Score - Hard - Dynamic ProgrammingYou are given an undirected tree rooted at node 0 with n nodes numbered from 0 to n - 1. Each node i has an integer value vals[i], and its parent is g... Topics: Array, Dynamic Programming, Bit Manipulation, Tree, Depth-First Search, Bitmask
- 2921. Count Stepping Numbers in Range - Hard - Dynamic ProgrammingGiven two positive integers low and high represented as strings, find the count of stepping numbers in the inclusive range [low, high]. A stepping num... Topics: String, Dynamic Programming
- 3835. Count Partitions With Max-Min Difference at Most K - Medium - Dynamic ProgrammingYou are given an integer array nums and an integer k. Your task is to partition nums into one or more non-empty contiguous segments such that in each ... Topics: Array, Dynamic Programming, Queue, Sliding Window, Prefix Sum, Monotonic Queue
- 3927. Minimum Cost Path with Alternating Directions II - Medium - Dynamic ProgrammingYou are given two integers m and n representing the number of rows and columns of a grid, respectively. The cost to enter cell (i, j) is defined as (i... Topics: Array, Dynamic Programming, Matrix
- 2504. Find All Good Indices - Medium - Dynamic ProgrammingYou are given a 0-indexed integer array nums of size n and a positive integer k. We call an index i in the range k <= i < n - k good if the following ... Topics: Array, Dynamic Programming, Prefix Sum
- 3867. Lexicographically Smallest String After Adjacent Removals - Hard - Dynamic ProgrammingYou are given a string s consisting of lowercase English letters. You can perform the following operation any number of times (including zero): Remove... Topics: String, Dynamic Programming
- 2164. Two Best Non-Overlapping Events - Medium - Dynamic ProgrammingYou are given a 0-indexed 2D integer array of events where events[i] = [startTimei, endTimei, valuei]. The ith event starts at startTimei and ends at ... Topics: Array, Binary Search, Dynamic Programming, Sorting, Heap (Priority Queue)
- 368. Largest Divisible Subset - Medium - Dynamic ProgrammingGiven a set of distinct positive integers nums, return the largest subset answer such that every pair (answer[i], answer[j]) of elements in this subse... Topics: Array, Math, Dynamic Programming, Sorting
- 1332. Count Vowels Permutation - Hard - Dynamic ProgrammingGiven an integer n, your task is to count how many strings of length n can be formed under the following rules: Each character is a lower case vowel (... Topics: Dynamic Programming
- 3842. Number of Ways to Assign Edge Weights II - Hard - Dynamic ProgrammingThere is an undirected tree with n nodes labeled from 1 to n, rooted at node 1. The tree is represented by a 2D integer array edges of length n - 1, w... Topics: Array, Math, Dynamic Programming, Tree, Depth-First Search
- 3431. Find the Minimum Cost Array Permutation - Hard - Dynamic ProgrammingYou are given an array nums which is a permutation of [0, 1, 2, ..., n - 1]. The score of any permutation of [0, 1, 2, ..., n - 1] named perm is defin... Topics: Array, Dynamic Programming, Bit Manipulation, Bitmask
- 3588. Count The Number of Winning Sequences - Hard - Dynamic ProgrammingAlice and Bob are playing a fantasy battle game consisting of n rounds where they summon one of three magical creatures each round: a Fire Dragon, a W... Topics: String, Dynamic Programming
- 980. Find the Shortest Superstring - Hard - Dynamic ProgrammingGiven an array of strings words, return the smallest string that contains each string in words as a substring. If there are multiple valid strings of ... Topics: Array, String, Dynamic Programming, Bit Manipulation, Bitmask
- 3618. Find the Original Typed String II - Hard - Dynamic ProgrammingAlice is attempting to type a specific string on her computer. However, she tends to be clumsy and may press a key for too long, resulting in a charac... Topics: String, Dynamic Programming, Prefix Sum
- 2710. Minimum Operations to Reduce an Integer to 0 - Medium - Dynamic ProgrammingYou are given a positive integer n, you can do the following operation any number of times: Add or subtract a power of 2 from n. Return the minimum nu... Topics: Dynamic Programming, Greedy, Bit Manipulation
- 1286. Constrained Subsequence Sum - Hard - Dynamic ProgrammingGiven an integer array nums and an integer k, return the maximum sum of a non-empty subsequence of that array such that for every two consecutive inte... Topics: Array, Dynamic Programming, Queue, Sliding Window, Heap (Priority Queue), Monotonic Queue
- 2709. Count the Number of Square-Free Subsets - Medium - Dynamic ProgrammingYou are given a positive integer 0-indexed array nums. A subset of the array nums is square-free if the product of its elements is a square-free integ... Topics: Array, Math, Dynamic Programming, Bit Manipulation, Bitmask
- 2904. Sorting Three Groups - Medium - Dynamic ProgrammingYou are given an integer array nums. Each element in nums is 1, 2 or 3. In each operation, you can remove an element from nums. Return the minimum num... Topics: Array, Binary Search, Dynamic Programming
- 2415. Count the Number of Ideal Arrays - Hard - Dynamic ProgrammingYou are given two integers n and maxValue, which are used to describe an ideal array. A 0-indexed integer array arr of length n is considered ideal if... Topics: Math, Dynamic Programming, Combinatorics, Number Theory
- 1692. Number of Ways to Reorder Array to Get Same BST - Hard - Dynamic ProgrammingGiven an array nums that represents a permutation of integers from 1 to n. We are going to construct a binary search tree (BST) by inserting the eleme... Topics: Array, Math, Divide and Conquer, Dynamic Programming, Tree, Union Find, Binary Search Tree, Memoization, Combinatorics, Binary Tree
- 1398. Number of Ways to Stay in the Same Place After Some Steps - Hard - Dynamic ProgrammingYou have a pointer at index 0 in an array of size arrLen. At each step, you can move 1 position to the left, 1 position to the right in the array, or ... Topics: Dynamic Programming
- 3239. Minimum Number of Operations to Make X and Y Equal - Medium - Dynamic ProgrammingYou are given two positive integers x and y. In one operation, you can do one of the four following operations: Divide x by 11 if x is a multiple of 1... Topics: Dynamic Programming, Breadth-First Search, Memoization
- 3535. Find the Count of Monotonic Pairs I - Hard - Dynamic ProgrammingYou are given an array of positive integers nums of length n. We call a pair of non-negative integer arrays (arr1, arr2) monotonic if: The lengths of ... Topics: Array, Math, Dynamic Programming, Combinatorics, Prefix Sum
- 2720. Minimize the Maximum Difference of Pairs - Medium - Dynamic ProgrammingYou are given a 0-indexed integer array nums and an integer p. Find p pairs of indices of nums such that the maximum difference amongst all the pairs ... Topics: Array, Binary Search, Dynamic Programming, Greedy, Sorting
- 1296. Kth Ancestor of a Tree Node - Hard - Dynamic ProgrammingYou are given a tree with n nodes numbered from 0 to n - 1 in the form of a parent array parent where parent[i] is the parent of ith node. The root of... Topics: Binary Search, Dynamic Programming, Tree, Depth-First Search, Breadth-First Search, Design
- 3857. Find Maximum Number of Non Intersecting Substrings - Medium - Dynamic ProgrammingYou are given a string word. Return the maximum number of non-intersecting substrings of word that are at least four characters long and start and end... Topics: Hash Table, String, Dynamic Programming, Greedy
- 1362. Airplane Seat Assignment Probability - Medium - Dynamic Programmingn passengers board an airplane with exactly n seats. The first passenger has lost the ticket and picks a seat randomly. But after that, the rest of th... Topics: Math, Dynamic Programming, Brainteaser, Probability and Statistics
- 1388. Greatest Sum Divisible by Three - Medium - Dynamic ProgrammingGiven an integer array nums, return the maximum possible sum of elements of the array such that it is divisible by three.... Topics: Array, Dynamic Programming, Greedy, Sorting
- 1676. Minimum Number of Days to Eat N Oranges - Hard - Dynamic ProgrammingThere are n oranges in the kitchen and you decided to eat some of these oranges every day as follows: Eat one orange. If the number of remaining orang... Topics: Dynamic Programming, Memoization
- 3637. Count Number of Balanced Permutations - Hard - Dynamic ProgrammingYou are given a string num. A string of digits is called balanced if the sum of the digits at even indices is equal to the sum of the digits at odd in... Topics: Math, String, Dynamic Programming, Combinatorics
- 2325. Number of Ways to Select Buildings - Medium - Dynamic ProgrammingYou are given a 0-indexed binary string s which represents the types of buildings along a street where: s[i] = '0' denotes that the ith building is an... Topics: String, Dynamic Programming, Prefix Sum
- 3482. Construct String with Minimum Cost - Hard - Dynamic ProgrammingYou are given a string target, an array of strings words, and an integer array costs, both arrays of the same length. Imagine an empty string s. You c... Topics: Array, String, Dynamic Programming, Suffix Array
- 1330. Longest Arithmetic Subsequence of Given Difference - Medium - Dynamic ProgrammingGiven an integer array arr and an integer difference, return the length of the longest subsequence in arr which is an arithmetic sequence such that th... Topics: Array, Hash Table, Dynamic Programming
- 3896. Minimum Time to Transport All Individuals - Hard - Dynamic ProgrammingYou are given n individuals at a base camp who need to cross a river to reach a destination using a single boat. The boat can carry at most k people a... Topics: Array, Dynamic Programming, Bit Manipulation, Graph, Heap (Priority Queue), Shortest Path, Bitmask
- 3793. Longest Palindrome After Substring Concatenation I - Medium - Dynamic ProgrammingYou are given two strings, s and t. You can create a new string by selecting a substring from s (possibly empty) and a substring from t (possibly empt... Topics: Two Pointers, String, Dynamic Programming, Enumeration
- 2855. Maximum Number of Jumps to Reach the Last Index - Medium - Dynamic ProgrammingYou are given a 0-indexed array nums of n integers and an integer target. You are initially positioned at index 0. In one step, you can jump from inde... Topics: Array, Dynamic Programming
- 3956. Trionic Array II - Hard - Dynamic ProgrammingYou are given an integer array nums of length n. A trionic subarray is a contiguous subarray nums[l...r] (with 0 <= l < r < n) for which there exist i... Topics: Array, Dynamic Programming
- 1087. Longest Arithmetic Subsequence - Medium - Dynamic ProgrammingGiven an array nums of integers, return the length of the longest arithmetic subsequence in nums. Note that: A subsequence is an array that can be der... Topics: Array, Hash Table, Binary Search, Dynamic Programming
- 808. Number of Matching Subsequences - Medium - Dynamic ProgrammingGiven a string s and an array of strings words, return the number of words[i] that is a subsequence of s. A subsequence of a string is a new string ge... Topics: Array, Hash Table, String, Binary Search, Dynamic Programming, Trie, Sorting
- 1277. Largest Multiple of Three - Hard - Dynamic ProgrammingGiven an array of digits digits, return the largest multiple of three that can be formed by concatenating some of the given digits in any order. If th... Topics: Array, Math, Dynamic Programming, Greedy, Sorting
- 1740. Count Subtrees With Max Distance Between Cities - Hard - Dynamic ProgrammingThere are n cities numbered from 1 to n. You are given an array edges of size n-1, where edges[i] = [ui, vi] represents a bidirectional edge between c... Topics: Dynamic Programming, Bit Manipulation, Tree, Enumeration, Bitmask
- 993. Tallest Billboard - Hard - Dynamic ProgrammingYou are installing a billboard and want it to have the largest height. The billboard will have two steel supports, one on each side. Each steel suppor... Topics: Array, Dynamic Programming
- 3826. Maximum Profit from Valid Topological Order in DAG - Hard - Dynamic ProgrammingYou are given a Directed Acyclic Graph (DAG) with n nodes labeled from 0 to n - 1, represented by a 2D array edges, where edges[i] = [ui, vi] indicate... Topics: Array, Dynamic Programming, Bit Manipulation, Graph, Topological Sort, Bitmask
- 3954. Maximum Balanced Shipments - Medium - Dynamic ProgrammingYou are given an integer array weight of length n, representing the weights of n parcels arranged in a straight line. A shipment is defined as a conti... Topics: Array, Dynamic Programming, Stack, Greedy, Monotonic Stack
- 2008. Minimum Cost to Change the Final Value of Expression - Hard - Dynamic ProgrammingYou are given a valid boolean expression as a string expression consisting of the characters '1','0','&' (bitwise AND operator),'|' (bitwise OR operat... Topics: Math, String, Dynamic Programming, Stack
- 3477. Minimum Operations to Make Binary Array Elements Equal to One II - Medium - Dynamic ProgrammingYou are given a binary array nums. You can do the following operation on the array any number of times (possibly zero): Choose any index i from the ar... Topics: Array, Dynamic Programming, Greedy
- 2530. Minimize Maximum of Array - Medium - Dynamic ProgrammingYou are given a 0-indexed array nums comprising of n non-negative integers. In one operation, you must: Choose an integer i such that 1 <= i < n and n... Topics: Array, Binary Search, Dynamic Programming, Greedy, Prefix Sum
- 1996. Number of Ways to Rearrange Sticks With K Sticks Visible - Hard - Dynamic ProgrammingThere are n uniquely-sized sticks whose lengths are integers from 1 to n. You want to arrange the sticks such that exactly k sticks are visible from t... Topics: Math, Dynamic Programming, Combinatorics
- 1443. Minimum Distance to Type a Word Using Two Fingers - Hard - Dynamic ProgrammingYou have a keyboard layout as shown above in the X-Y plane, where each English uppercase letter is located at some coordinate. For example, the letter... Topics: String, Dynamic Programming
- 1394. Minimum Path Cost in a Grid - Medium - Dynamic ProgrammingYou are given a 0-indexed m x n integer matrix grid consisting of distinct integers from 0 to m * n - 1. You can move in this matrix from a cell to an... Topics: Array, Dynamic Programming, Matrix
- 1474. Longest ZigZag Path in a Binary Tree - Medium - Dynamic ProgrammingYou are given the root of a binary tree. A ZigZag path for a binary tree is defined as follow: Choose any node in the binary tree and a direction (rig... Topics: Dynamic Programming, Tree, Depth-First Search, Binary Tree
- 1659. Get the Maximum Score - Hard - Dynamic ProgrammingYou are given two sorted arrays of distinct integers nums1 and nums2. A valid path is defined as follows: Choose array nums1 or nums2 to traverse (fro... Topics: Array, Two Pointers, Dynamic Programming, Greedy
- 1381. Maximum Score Words Formed by Letters - Hard - Dynamic ProgrammingGiven a list of words, list of single letters (might be repeating) and score of every character. Return the maximum score of any valid set of words f... Topics: Array, String, Dynamic Programming, Backtracking, Bit Manipulation, Bitmask
- 1527. Number of Ways to Paint N × 3 Grid - Hard - Dynamic ProgrammingYou have a grid of size n x 3 and you want to paint each cell of the grid with exactly one of the three colors: Red, Yellow, or Green while making sur... Topics: Dynamic Programming
- 3518. Maximum Multiplication Score - Medium - Dynamic ProgrammingYou are given an integer array a of size 4 and another integer array b of size at least 4. You need to choose 4 indices i0, i1, i2, and i3 from the ar... Topics: Array, Dynamic Programming
- 3142. Longest Unequal Adjacent Groups Subsequence II - Medium - Dynamic ProgrammingYou are given a string array words, and an array groups, both arrays having length n. The hamming distance between two strings of equal length is the ... Topics: Array, String, Dynamic Programming
- 3810. Count Numbers with Non-Decreasing Digits - Hard - Dynamic ProgrammingYou are given two integers, l and r, represented as strings, and an integer b. Return the count of integers in the inclusive range [l, r] whose digits... Topics: Math, String, Dynamic Programming
- 3017. Number of Beautiful Integers in the Range - Hard - Dynamic ProgrammingYou are given positive integers low, high, and k. A number is beautiful if it meets both of the following conditions: The count of even digits in the ... Topics: Math, Dynamic Programming
- 3648. Find the Maximum Number of Fruits Collected - Hard - Dynamic ProgrammingThere is a game dungeon comprised of n x n rooms arranged in a grid. You are given a 2D array fruits of size n x n, where fruits[i][j] represents the ... Topics: Array, Dynamic Programming, Matrix
- 867. New 21 Game - Medium - Dynamic ProgrammingAlice plays the following game, loosely based on the card game "21". Alice starts with 0 points and draws numbers while she has less than k points. Du... Topics: Math, Dynamic Programming, Sliding Window, Probability and Statistics
- 1571. Allocate Mailboxes - Hard - Dynamic ProgrammingGiven the array houses where houses[i] is the location of the ith house along a street and an integer k, allocate k mailboxes in the street. Return th... Topics: Array, Math, Dynamic Programming, Sorting
- 2191. Minimum Number of Food Buckets to Feed the Hamsters - Medium - Dynamic ProgrammingYou are given a 0-indexed string hamsters where hamsters[i] is either: 'H' indicating that there is a hamster at index i, or '.' indicating that index... Topics: String, Dynamic Programming, Greedy
- 2187. Vowels of All Substrings - Medium - Dynamic ProgrammingGiven a string word, return the sum of the number of vowels ('a', 'e', 'i', 'o', and 'u') in every substring of word. A substring is a contiguous (non... Topics: Math, String, Dynamic Programming, Combinatorics
- 3140. Count Visited Nodes in a Directed Graph - Hard - Dynamic ProgrammingThere is a directed graph consisting of n nodes numbered from 0 to n - 1 and n directed edges. You are given a 0-indexed array edges where edges[i] in... Topics: Dynamic Programming, Graph, Memoization
- 1489. Pizza With 3n Slices - Hard - Dynamic ProgrammingThere is a pizza with 3n slices of varying size, you and your friends will take slices of pizza as follows: You will pick any pizza slice. Your friend... Topics: Array, Dynamic Programming, Greedy, Heap (Priority Queue)
- 823. Split Array With Same Average - Hard - Dynamic ProgrammingYou are given an integer array nums. You should move each element of nums into one of the two arrays A and B such that A and B are non-empty, and aver... Topics: Array, Math, Dynamic Programming, Bit Manipulation, Bitmask
- 313. Super Ugly Number - Medium - Dynamic ProgrammingA super ugly number is a positive integer whose prime factors are in the array primes. Given an integer n and an array of integers primes, return the ... Topics: Array, Math, Dynamic Programming
- 1475. Maximum Sum BST in Binary Tree - Hard - Dynamic ProgrammingGiven a binary tree root, return the maximum sum of all keys of any sub-tree which is also a Binary Search Tree (BST). Assume a BST is defined as foll... Topics: Dynamic Programming, Tree, Depth-First Search, Binary Search Tree, Binary Tree
- 458. Poor Pigs - Hard - Dynamic ProgrammingThere are buckets buckets of liquid, where exactly one of the buckets is poisonous. To figure out which one is poisonous, you feed some number of (poo... Topics: Math, Dynamic Programming, Combinatorics
- 2696. The Number of Beautiful Subsets - Medium - Dynamic ProgrammingYou are given an array nums of positive integers and a positive integer k. A subset of nums is beautiful if it does not contain two integers with an a... Topics: Array, Hash Table, Math, Dynamic Programming, Backtracking, Sorting, Combinatorics
- 2652. Count Number of Possible Root Nodes - Hard - Dynamic ProgrammingAlice has an undirected tree with n nodes labeled from 0 to n - 1. The tree is represented as a 2D integer array edges of length n - 1 where edges[i] ... Topics: Array, Hash Table, Dynamic Programming, Tree, Depth-First Search
- 3092. Minimum Moves to Spread Stones Over Grid - Medium - Dynamic ProgrammingYou are given a 0-indexed 2D integer matrix grid of size 3 * 3, representing the number of stones in each cell. The grid contains exactly 9 stones, an... Topics: Array, Dynamic Programming, Breadth-First Search, Matrix
- 1989. Minimum XOR Sum of Two Arrays - Hard - Dynamic ProgrammingYou are given two integer arrays nums1 and nums2 of length n. The XOR sum of the two integer arrays is (nums1[0] XOR nums2[0]) + (nums1[1] XOR nums2[1... Topics: Array, Dynamic Programming, Bit Manipulation, Bitmask
- 2115. Number of Unique Good Subsequences - Hard - Dynamic ProgrammingYou are given a binary string binary. A subsequence of binary is considered good if it is not empty and has no leading zeros (with the exception of "0... Topics: String, Dynamic Programming
- 938. Numbers At Most N Given Digit Set - Hard - Dynamic ProgrammingGiven an array of digits which is sorted in non-decreasing order. You can write numbers using each digits[i] as many times as we want. For example, if... Topics: Array, Math, String, Binary Search, Dynamic Programming
- 2017. Minimum Number of Flips to Make the Binary String Alternating - Medium - Dynamic ProgrammingYou are given a binary string s. You are allowed to perform two types of operations on the string in any sequence: Type-1: Remove the character at the... Topics: String, Dynamic Programming, Sliding Window
- 1896. Maximum Score from Performing Multiplication Operations - Hard - Dynamic ProgrammingYou are given two 0-indexed integer arrays nums and multipliers of size n and m respectively, where n >= m. You begin with a score of 0. You want to p... Topics: Array, Dynamic Programming
- 3032. Maximize Value of Function in a Ball Passing Game - Hard - Dynamic ProgrammingYou are given an integer array receiver of length n and an integer k. n players are playing a ball-passing game. You choose the starting player, i. Th... Topics: Array, Dynamic Programming, Bit Manipulation
- 3470. Maximum Score From Grid Operations - Hard - Dynamic ProgrammingYou are given a 2D matrix grid of size n x n. Initially, all cells of the grid are colored white. In one operation, you can select any cell of indices... Topics: Array, Dynamic Programming, Matrix, Prefix Sum
- 2028. The Earliest and Latest Rounds Where Players Compete - Hard - Dynamic ProgrammingThere is a tournament where n players are participating. The players are standing in a single row and are numbered from 1 to n based on their initial ... Topics: Dynamic Programming, Memoization
- 629. K Inverse Pairs Array - Hard - Dynamic ProgrammingFor an integer array nums, an inverse pair is a pair of integers [i, j] where 0 <= i < j < nums.length and nums[i] > nums[j]. Given two integers n and... Topics: Dynamic Programming
- 1577. Probability of a Two Boxes Having The Same Number of Distinct Balls - Hard - Dynamic ProgrammingGiven 2n balls of k distinct colors. You will be given an integer array balls of size k where balls[i] is the number of balls of color i. All the ball... Topics: Array, Math, Dynamic Programming, Backtracking, Combinatorics, Probability and Statistics
- 3654. Minimum Array Sum - Medium - Dynamic ProgrammingYou are given an integer array nums and three integers k, op1, and op2. You can perform the following operations on nums: Operation 1: Choose an index... Topics: Array, Dynamic Programming
- 3200. Number of Strings Which Can Be Rearranged to Contain Substring - Medium - Dynamic ProgrammingYou are given an integer n. A string s is called good if it contains only lowercase English characters and it is possible to rearrange the characters ... Topics: Math, Dynamic Programming, Combinatorics
- 843. Binary Trees With Factors - Medium - Dynamic ProgrammingGiven an array of unique integers, arr, where each integer arr[i] is strictly greater than 1. We make a binary tree using these integers, and each num... Topics: Array, Hash Table, Dynamic Programming, Sorting
- 868. Push Dominoes - Medium - Dynamic ProgrammingThere are n dominoes in a line, and we place each domino vertically upright. In the beginning, we simultaneously push some of the dominoes either to t... Topics: Two Pointers, String, Dynamic Programming
- 1632. Number of Good Ways to Split a String - Medium - Dynamic ProgrammingYou are given a string s. A split is called good if you can split s into two non-empty strings sleft and sright where their concatenation is equal to ... Topics: Hash Table, String, Dynamic Programming, Bit Manipulation
- 3831. Find X Value of Array I - Medium - Dynamic ProgrammingYou are given an array of positive integers nums, and a positive integer k. You are allowed to perform an operation once on nums, where in each operat... Topics: Array, Math, Dynamic Programming
- 3490. Find the Maximum Length of Valid Subsequence I - Medium - Dynamic ProgrammingYou are given an integer array nums. A subsequence sub of nums with length x is called valid if it satisfies: (sub[0] + sub[1]) % 2 == (sub[1] + sub[2... Topics: Array, Dynamic Programming
- 3112. Count Valid Paths in a Tree - Hard - Dynamic ProgrammingThere is an undirected tree with n nodes labeled from 1 to n. You are given the integer n and a 2D integer array edges of length n - 1, where edges[i]... Topics: Math, Dynamic Programming, Tree, Depth-First Search, Number Theory
- 413. Arithmetic Slices - Medium - Dynamic ProgrammingAn integer array is called arithmetic if it consists of at least three elements and if the difference between any two consecutive elements is the same... Topics: Array, Dynamic Programming, Sliding Window
- 553. Optimal Division - Medium - Dynamic ProgrammingYou are given an integer array nums. The adjacent integers in nums will perform the float division. For example, for nums = [2,3,4], we will evaluate ... Topics: Array, Math, Dynamic Programming
- 730. Count Different Palindromic Subsequences - Hard - Dynamic ProgrammingGiven a string s, return the number of different non-empty palindromic subsequences in s. Since the answer may be very large, return it modulo 109 + 7... Topics: String, Dynamic Programming
- 2130. Maximum Product of the Length of Two Palindromic Subsequences - Medium - Dynamic ProgrammingGiven a string s, find two disjoint palindromic subsequences of s such that the product of their lengths is maximized. The two subsequences are disjoi... Topics: String, Dynamic Programming, Backtracking, Bit Manipulation, Bitmask
- 396. Rotate Function - Medium - Dynamic ProgrammingYou are given an integer array nums of length n. Assume arrk to be an array obtained by rotating nums by k positions clock-wise. We define the rotatio... Topics: Array, Math, Dynamic Programming
- 1228. Minimum Cost Tree From Leaf Values - Medium - Dynamic ProgrammingGiven an array arr of positive integers, consider all binary trees such that: Each node has either 0 or 2 children; The values of arr correspond to th... Topics: Array, Dynamic Programming, Stack, Greedy, Monotonic Stack
- 1685. Stone Game V - Hard - Dynamic ProgrammingThere are several stones arranged in a row, and each stone has an associated value which is an integer given in the array stoneValue. In each round of... Topics: Array, Math, Dynamic Programming, Game Theory
- 3629. Total Characters in String After Transformations I - Medium - Dynamic ProgrammingYou are given a string s and an integer t, representing the number of transformations to perform. In one transformation, every character in s is repla... Topics: Hash Table, Math, String, Dynamic Programming, Counting
- 472. Concatenated Words - Hard - Dynamic ProgrammingGiven an array of strings words (without duplicates), return all the concatenated words in the given list of words. A concatenated word is defined as ... Topics: Array, String, Dynamic Programming, Depth-First Search, Trie, Sorting
- 1096. Maximum Sum of Two Non-Overlapping Subarrays - Medium - Dynamic ProgrammingGiven an integer array nums and two integers firstLen and secondLen, return the maximum sum of elements in two non-overlapping subarrays with lengths ... Topics: Array, Dynamic Programming, Sliding Window
- 1418. Fair Distribution of Cookies - Medium - Dynamic ProgrammingYou are given an integer array cookies, where cookies[i] denotes the number of cookies in the ith bag. You are also given an integer k that denotes th... Topics: Array, Dynamic Programming, Backtracking, Bit Manipulation, Bitmask
- 1348. Maximum Score Of Spliced Array - Hard - Dynamic ProgrammingYou are given two 0-indexed integer arrays nums1 and nums2, both of length n. You can choose two integers left and right where 0 <= left <= right < n ... Topics: Array, Dynamic Programming
- 343. Integer Break - Medium - Dynamic ProgrammingGiven an integer n, break it into the sum of k positive integers, where k >= 2, and maximize the product of those integers. Return the maximum product... Topics: Math, Dynamic Programming
- 1881. Closest Subsequence Sum - Hard - Dynamic ProgrammingYou are given an integer array nums and an integer goal. You want to choose a subsequence of nums such that the sum of its elements is the closest pos... Topics: Array, Two Pointers, Dynamic Programming, Bit Manipulation, Sorting, Bitmask
- 3733. Length of Longest V-Shaped Diagonal Segment - Hard - Dynamic ProgrammingYou are given a 2D integer matrix grid of size n x m, where each element is either 0, 1, or 2. A V-shaped diagonal segment is defined as: The segment ... Topics: Array, Dynamic Programming, Memoization, Matrix
- 689. Maximum Sum of 3 Non-Overlapping Subarrays - Hard - Dynamic ProgrammingGiven an integer array nums and an integer k, find three non-overlapping subarrays of length k with maximum sum and return them. Return the result as ... Topics: Array, Dynamic Programming, Sliding Window, Prefix Sum
- 804. Rotated Digits - Medium - Dynamic ProgrammingAn integer x is a good if after rotating each digit individually by 180 degrees, we get a valid number that is different from x. Each digit must be ro... Topics: Math, Dynamic Programming
- 2905. Count Paths That Can Form a Palindrome in a Tree - Hard - Dynamic ProgrammingYou are given a tree (i.e. a connected, undirected graph that has no cycles) rooted at node 0 consisting of n nodes numbered from 0 to n - 1. The tree... Topics: Dynamic Programming, Bit Manipulation, Tree, Depth-First Search, Bitmask
- 855. Count Unique Characters of All Substrings of a Given String - Hard - Dynamic ProgrammingLet's define a function countUniqueChars(s) that returns the number of unique characters in s. For example, calling countUniqueChars(s) if s = "LEETCO... Topics: Hash Table, String, Dynamic Programming
- 376. Wiggle Subsequence - Medium - Dynamic ProgrammingA wiggle sequence is a sequence where the differences between successive numbers strictly alternate between positive and negative. The first differenc... Topics: Array, Dynamic Programming, Greedy
- 3631. Count K-Reducible Numbers Less Than N - Hard - Dynamic ProgrammingYou are given a binary string s representing a number n in its binary form. You are also given an integer k. An integer x is called k-reducible if per... Topics: Math, String, Dynamic Programming, Combinatorics
- 3487. Find Maximum Removals From Source String - Medium - Dynamic ProgrammingYou are given a string source of size n, a string pattern that is a subsequence of source, and a sorted integer array targetIndices that contains dist... Topics: Array, Hash Table, Two Pointers, String, Dynamic Programming
- 1569. Max Dot Product of Two Subsequences - Hard - Dynamic ProgrammingGiven two arrays nums1 and nums2. Return the maximum dot product between non-empty subsequences of nums1 and nums2 with the same length. A subsequence... Topics: Array, Dynamic Programming
Related LeetCode Topics
- Array LeetCode Problems
- Backtracking LeetCode Problems
- Biconnected Component LeetCode Problems
- Binary Indexed Tree LeetCode Problems
- Binary Search LeetCode Problems
- Binary Search Tree LeetCode Problems
- Binary Tree LeetCode Problems
- Bit Manipulation LeetCode Problems
- Bitmask LeetCode Problems
- Brainteaser LeetCode Problems
- Breadth-First Search LeetCode Problems
- Bucket Sort LeetCode Problems
- Combinatorics LeetCode Problems
- Concurrency LeetCode Problems
- Counting LeetCode Problems
- Counting Sort LeetCode Problems
- Data Stream LeetCode Problems
- Database LeetCode Problems
- Depth-First Search LeetCode Problems
- Design LeetCode Problems