训练重点
强调边界案例、优化推导与追问防守。
建议节奏
每轮 3-5 题,先口述思路再写代码,最后复盘错误路径。
搭配建议
结合模式页和题型页同步练,能更快形成可迁移能力。
寻找两个正序数组的中位数
Find the median of two sorted arrays using binary search for efficient O(log(min(m, n))) time complexity.
正则表达式匹配
The Regular Expression Matching problem involves checking if a string matches a pattern using '.' and '*'.
合并 K 个升序链表
Merge k Sorted Lists requires efficiently combining multiple sorted linked lists into one using pointers and priority qu…
K 个一组翻转链表
Reverse Nodes in k-Group challenges you to reverse segments of a linked list in groups of size k.
串联所有单词的子串
Find all starting indices of substrings in a string that are concatenations of a given list of words.
最长有效括号
Compute the length of the longest well-formed parentheses substring using state transition dynamic programming and stack…
解数独
Solve the Sudoku puzzle by filling empty cells while respecting Sudoku's rules using array scanning and backtracking.
缺失的第一个正数
Identify the smallest missing positive integer in an unsorted array using constant space and linear time scanning techni…
接雨水
Calculate the total trapped rain water using the elevation map array, leveraging dynamic programming and two-pointer pat…
通配符匹配
Implement full wildcard pattern matching using '?' and '*' by applying state transition dynamic programming with careful…
N 皇后
Solve the N-Queens problem using backtracking with pruning, exploring all valid board placements while avoiding conflict…
N 皇后 II
Solve the N-Queens II problem using backtracking with pruning to efficiently count all valid placements for n queens on …
排列序列
Find the kth permutation sequence of a set of numbers using math and recursion to efficiently compute the result.
有效数字
Determine if a given string represents a valid number using precise string parsing and character validation rules.
文本左右对齐
Text Justification requires packing words into lines to match a specified width, ensuring even distribution of spaces.
最小覆盖子串
Find the smallest substring of s containing all characters from t using a sliding window with running state updates for …
柱状图中最大的矩形
Find the maximal rectangular area in a histogram using stack-based state management for precise bar tracking and width c…
最大矩形
Compute the largest rectangle of 1's in a binary matrix using dynamic programming and stack-based state transitions effi…
扰乱字符串
Scramble String is a dynamic programming problem where we determine if one string can be scrambled to form another using…
不同的子序列
Compute the number of distinct subsequences of one string matching another using precise state transition dynamic progra…
买卖股票的最佳时机 III
Determine the maximum profit from at most two stock transactions using state transition dynamic programming on price arr…
二叉树中的最大路径和
Calculate the maximum sum of any path in a binary tree by exploring all node sequences using DFS and dynamic programming…
单词接龙 II
Find all shortest transformation sequences from beginWord to endWord using a dictionary, leveraging backtracking search …
单词接龙
Find the shortest transformation sequence from a start word to an end word, with each word in the sequence differing by …
分割回文串 II
Determine the minimum cuts required to partition a string into all palindromic substrings using dynamic programming tech…
分发糖果
The Candy problem is a greedy algorithm challenge where you need to minimize candy distribution while satisfying certain…
单词拆分 II
Given a string and dictionary, return all possible sentences by adding spaces where each word is in the dictionary.
直线上最多的点数
Find the maximum number of points on a straight line in a 2D plane using array scanning and hash lookup.
寻找旋转排序数组中的最小值 II
Find the minimum in a rotated sorted array with possible duplicates using binary search.
地下城游戏
Calculate the minimum initial health the knight needs to survive the dungeon using state transition dynamic programming …
买卖股票的最佳时机 IV
Determine the maximum profit from at most k stock transactions using state transition dynamic programming on an array of…
单词搜索 II
Solve the Word Search II problem using backtracking with pruning to find all words on a board of characters.
最短回文串
The Shortest Palindrome problem asks to transform a string into a palindrome by adding characters at the beginning, with…
天际线问题
The Skyline Problem requires calculating a city's silhouette using array manipulation and divide-and-conquer techniques …
存在重复元素 III
The problem involves finding a pair of indices in an array where the index and value differences are within given limits…
基本计算器
Implement a basic calculator to evaluate mathematical expressions, ensuring correct evaluation with stack-based manageme…
数字 1 的个数
Compute the total number of digit one appearing in all numbers from 0 up to n using state transition dynamic programming…
滑动窗口最大值
Solve the "Sliding Window Maximum" problem using efficient techniques like the sliding window, deque, and priority queue…
整数转换英文表示
Convert a given integer to its English words representation using mathematical logic and string manipulation.
给表达式添加运算符
Expression Add Operators is solved with backtracking that builds multi-digit operands and tracks multiplication preceden…
数据流的中位数
Implement a MedianFinder class that supports adding numbers and finding the median from a data stream.
二叉树的序列化与反序列化
This problem asks to serialize and deserialize a binary tree, requiring an efficient approach to handle traversal and st…
删除无效的括号
Remove the minimum number of invalid parentheses to generate all possible valid strings efficiently using backtracking a…
戳气球
Burst Balloons is a hard dynamic programming problem requiring careful state transitions to maximize coins collected eff…
计算右侧小于当前元素的个数
Solve the Count of Smaller Numbers After Self problem using binary search and optimized algorithms.
拼接最大数
Create Maximum Number involves merging digits from two arrays while preserving order, maximizing the resulting number.
区间和的个数
Count the number of subarray sums within a given inclusive range using optimized divide-and-conquer techniques efficient…
矩阵中的最长递增路径
Find the length of the longest increasing path in a matrix with given movement constraints using graph techniques.
按要求补齐数组
Patching Array requires adding the minimum numbers to cover all sums from 1 to n using greedy choices and invariant chec…
重新安排行程
Reconstruct Itinerary requires building a valid travel route using all tickets once, starting from JFK with lexical orde…
路径交叉
Determine if a path defined by sequential distances on a 2D plane crosses itself using array and math reasoning.
回文对
Find all pairs of words in a list that form palindromes when concatenated using efficient scanning and hash mapping.
将数据流变为多个不相交区间
The problem involves designing a class to summarize a data stream of non-negative integers as disjoint intervals using b…
俄罗斯套娃信封问题
Russian Doll Envelopes is a dynamic programming problem that involves finding the longest chain of envelopes that can be…
矩形区域不超过 K 的最大数值和
Solve the "Max Sum of Rectangle No Larger Than K" problem using binary search over the valid sum space to optimize space…
O(1) 时间插入、删除和获取随机元素 - 允许重复
This problem challenges you to design a data structure that supports insertion, removal, and random access with O(1) tim…
完美矩形
Determine if given axis-aligned rectangles form a perfect cover using array scanning and hash-based corner counting tech…
青蛙过河
Determine if a frog can cross a river using jumps constrained by previous step sizes in a dynamic programming state tran…
接雨水 II
Solve Trapping Rain Water II using breadth-first search and priority queues for efficient water trapping in a matrix.
分割数组的最大值
Solve the 'Split Array Largest Sum' problem by minimizing the largest sum across k subarrays using dynamic programming a…
强密码检验器
The Strong Password Checker problem challenges you to optimize password strength while minimizing steps using greedy alg…
全 O(1) 的数据结构
Implement a data structure that tracks string counts and retrieves max or min keys efficiently in constant time.
字典序的第K小数字
Find the k-th lexicographically smallest integer in a range using a Trie-based approach.
等差数列划分 II - 子序列
Count all arithmetic subsequences in an array using dynamic programming with precise state transitions for correctness.
可怜的小猪
Find the minimum number of pigs required to determine the poisonous bucket within a set time using state transition dyna…
LFU 缓存
Implement an LFU Cache using linked-list pointer manipulation with constant-time get and put operations for interview sc…
统计重复个数
This problem requires counting how many times a repeated string s2 fits as a subsequence within a repeated string s1 usi…
连接词
Find concatenated words by using dynamic programming and depth-first search to identify valid words made of other words …
最大回文数乘积
Find the largest palindromic number from the product of two n-digit integers using math and enumeration efficiently.
滑动窗口中位数
Compute the median for each sliding window of size k in an array using efficient array scanning and hash lookup techniqu…
最小好进制
Find the smallest good base of an integer n using binary search over the valid answer space.
祖玛游戏
The Zuma Game involves clearing balls from the board using a limited hand, applying dynamic programming and state transi…
翻转对
Count the number of reverse pairs in a given integer array using efficient algorithms like binary search and merge sort.
IPO
Maximize total capital by selecting up to k projects, based on initial capital and project profits using a greedy strate…
自由之路
Determine the minimum rotations and button presses to spell a keyword on a circular dial using state transition dynamic …
超级洗衣机
Calculate the minimum moves to balance dresses across washing machines using a greedy strategy and invariant validation …
移除盒子
Maximize points by strategically removing contiguous same-colored boxes using state transition dynamic programming and m…
学生出勤记录 II
The Student Attendance Record II problem explores counting valid student attendance sequences using dynamic programming …
寻找最近的回文数
Identify the nearest palindrome to a given integer string, handling ties and large numbers efficiently using math and st…
安装栅栏
Find the perimeter fence of a garden by determining the outermost trees in a set of given tree coordinates.
标签验证器
The Tag Validator problem involves validating a code snippet by parsing through tags using a stack-based state managemen…
不含连续1的非负整数
Count non-negative integers up to n without consecutive ones in their binary representation using dynamic programming.
K 个逆序对数组
The K Inverse Pairs Array problem focuses on counting arrays with exactly k inverse pairs using dynamic programming.
课程表 III
Solve the 'Course Schedule III' problem with a greedy approach involving course selection and validation of constraints.
最小区间
Find the minimal range covering at least one number from each of k sorted lists using array scanning and hash lookup eff…
解码方法 II
Decode Ways II is a challenging dynamic programming problem that involves decoding messages with digits and wildcard cha…
奇怪的打印机
Calculate the minimum turns a strange printer needs to print any string using state transition dynamic programming effic…
乘法表中第k小的数
Find the kth smallest number in an m x n multiplication table using binary search over the valid answer space.
为高尔夫比赛砍树
Determine the minimum steps to cut all trees in a forest matrix in ascending height order using BFS traversal and priori…
24 点游戏
Solve the 24 Game by arranging four card numbers using arithmetic operators and parentheses to reach exactly 24 efficien…
冗余连接 II
Find and remove the redundant connection in a directed graph that was originally a rooted tree.
三个无重叠子数组的最大和
Maximize the sum of three non-overlapping subarrays with length k in an integer array using dynamic programming.
贴纸拼词
Determine the minimum number of stickers needed to spell a target word using array scanning and hash lookups for efficie…
掉落的方块
Solve Falling Squares by efficiently computing maximum stack heights using arrays with segment tree optimization techniq…
黑名单中的随机数
Random Pick with Blacklist requires designing a method to uniformly pick integers while excluding blacklisted values eff…
Range 模块
Design a RangeModule to track and query half-open intervals using segment trees or ordered sets.
找出第 K 小的数对距离
Solve Find K-th Smallest Pair Distance by sorting nums, then binary searching the distance and counting valid pairs with…
原子的数量
Compute the exact count of each atom in a chemical formula using stack-based state management and hashing techniques eff…
统计不同回文子序列
Count Different Palindromic Subsequences leverages dynamic programming to count non-empty palindromic subsequences in a …
我的日程安排表 III
Implement My Calendar III to track maximum overlapping events efficiently using binary search and segment tree technique…
Lisp 语法解析
Parse Lisp expressions using stack-based state management to evaluate variables and operations.
摘樱桃
Maximize cherries collected on a grid, employing state transition dynamic programming with careful navigation across obs…
前缀和后缀搜索
Design a dictionary to search words by both prefix and suffix using a Trie structure and hash lookups.
隔离病毒
Contain Virus involves using array-based Depth-First Search to contain viral spread by building walls around infected re…
破解保险箱
The Cracking the Safe problem involves finding the shortest password sequence to unlock a safe using graph traversal and…
设置交集大小至少为2
Solve the Set Intersection Size At Least Two problem using a greedy approach and invariant validation.
特殊的二进制字符串
Solve the Special Binary String problem using string manipulation and recursion, optimizing lexicographical order.
情侣牵手
This problem requires arranging couples sitting apart in a row with the minimum number of swaps using graph traversal an…
最多能完成排序的块 II
Determine the maximum number of chunks you can split an array into so that sorting each chunk results in a fully sorted …
基本计算器 IV
Simplify mathematical expressions using stack-based state management, handling variables, operators, and polynomial term…
滑动谜题
Determine the minimum moves to solve a 2x3 sliding puzzle using BFS and state transition dynamic programming techniques …
水位上升的泳池中游泳
Solve the problem of swimming through a grid of rising water with a binary search on the valid answer space.
到达终点
Determine whether it is possible to reach a target point from a start point using repeated additive moves following stri…
变为棋盘
Determine the minimum swaps of rows or columns to convert an n x n binary board into a valid chessboard configuration.
阶乘函数后 K 个零
Solve for the number of integers whose factorial ends with a specific number of zeroes using binary search techniques.
得分最高的最小轮调
Find the smallest rotation index with the highest score using array and prefix sum techniques.
使序列递增的最小交换次数
This problem involves finding the minimum number of swaps needed to make two sequences strictly increasing using dynamic…
打砖块
Bricks Falling When Hit challenges your ability to simulate brick falls after sequential erasures using Union Find.
数组的均值分割
Determine whether an integer array can be partitioned into two non-empty subarrays with the same average using dynamic p…
黑板异或游戏
The Chalkboard XOR Game is a game theory problem involving array manipulation and bitwise XOR, where players alternate e…
公交路线
Bus Routes is solved by BFS over buses and stops, using stop-to-route hashing to avoid expensive repeated route scans.
赛车
Race Car is a dynamic programming problem where the goal is to find the shortest sequence of instructions to reach a tar…
最大人工岛
Calculate the largest island size by converting at most one zero in a binary grid using array and DFS techniques efficie…
统计子串中的唯一字符
Calculate the sum of unique characters in all substrings of a string using state transition dynamic programming.
连续整数求和
Find the number of ways to express a number as the sum of consecutive positive integers.
树中距离之和
The problem asks to compute the sum of distances between each node and all others in a tree structure using depth-first …
相似字符串组
Determine the number of connected groups of similar strings by swapping at most two letters using array scanning and has…
猜猜这个单词
Master the Guess the Word problem by applying array manipulation, match-counting math, and strategic interactive guessin…
访问所有节点的最短路径
Solve the Shortest Path Visiting All Nodes problem by exploring dynamic programming, bit manipulation, and breadth-first…
矩形面积 II
The problem involves calculating the total area covered by multiple rectangles, ensuring overlap is counted only once.
相似度为 K 的字符串
K-Similar Strings involves finding the minimal number of swaps to transform one string into another through character sw…
雇佣 K 名工人的最低成本
Find the minimum cost to hire exactly k workers based on quality and wage expectations in this challenging greedy proble…
和至少为 K 的最短子数组
Find the shortest subarray with a sum of at least k using binary search and sliding window techniques.
获取所有钥匙的最短路径
Find the minimum steps to collect all keys in a grid using BFS and bitmasking, handling locks efficiently.
最低加油次数
Determine the minimum number of refueling stops needed to reach a target using dynamic programming and greedy strategies…
第 N 个神奇数字
Find the nth magical number divisible by a or b, using binary search to efficiently handle large inputs.
盈利计划
Given a group of members and a list of crimes, count the profitable schemes that meet the profit and group constraints.
细分图中的可到达节点
The Reachable Nodes In Subdivided Graph problem requires efficiently finding the reachable nodes using graph traversal a…
鸡蛋掉落
Solve the Super Egg Drop problem using dynamic programming and binary search to minimize the number of moves required to…
子序列宽度之和
Calculate the sum of widths for all subsequences in an integer array using sorting and combinatorial math efficiently.
最大频率栈
Design a stack-like data structure to manage elements and handle frequent stack operations, including popping the most f…
有序队列
Given a string and integer k, rearrange characters to achieve the lexicographically smallest string using limited rotati…
最大为 N 的数字组合
The 'Numbers At Most N Given Digit Set' problem requires calculating how many numbers can be formed using a given digit …
DI 序列的有效排列
The problem asks to find the number of valid permutations for a given DI sequence string using dynamic programming and s…
超级回文数
Count all super-palindromes in a given numeric range, where each is a palindrome and square of a palindrome.
猫和老鼠
Determine the outcome of a two-player Cat and Mouse game on a graph using topological ordering and memoized dynamic prog…
播放列表的数量
Solve the Number of Music Playlists problem with dynamic programming, focusing on state transitions and combinatorics to…
尽量减少恶意软件的传播
Identify which single infected node to remove to minimize total malware spread in a connected network graph efficiently.
三等分
Divide a binary array into three contiguous parts such that each part represents the same integer value in binary, using…
尽量减少恶意软件的传播 II
Minimize Malware Spread II asks to minimize the spread of malware in a network of nodes by removing one infected node.
戳印序列
Solve Stamping The Sequence with stack-based state management to convert string s to target using stamp efficiently.
不同的子序列 II
Find the number of distinct non-empty subsequences of a string using dynamic programming and state transitions.
最短超级串
This problem requires constructing the shortest string containing all input words using state transition dynamic program…
按公因数计算最大组件大小
Find the largest connected component in an array where edges exist between numbers sharing a common factor greater than …
最高的广告牌
Solve the Tallest Billboard problem by using dynamic programming to find the maximum equal height for two disjoint rod s…
删列造序 III
The problem requires minimizing deletions to ensure all strings are lexicographically sorted. Use dynamic programming fo…
表示数字的最少运算符
Compute the minimum number of arithmetic operators to form a target using repeated x with addition, subtraction, multipl…
监控二叉树
Determine the minimum number of cameras required to monitor every node in a binary tree using efficient DFS and state tr…
相等的有理数
Given two rational numbers as strings with possible repeating decimals, determine if they represent the same number.
奇偶跳
Determine the number of valid starting indices in an array where you can reach the end with alternating odd and even jum…
不同路径 III
Solve the Unique Paths III problem using backtracking search with pruning to count 4-directional paths covering all empt…
按位与为零的三元组
Count all index triples in an array where the bitwise AND of their elements equals zero using efficient bit manipulation…
二叉树的垂序遍历
Perform a vertical order traversal of a binary tree, sorting nodes by their values within columns.
K 个不同整数的子数组
Find subarrays with exactly k distinct integers in an integer array using sliding window and hash lookup techniques.
K 连续位的最小翻转次数
Determine the minimum number of k-length consecutive bit flips needed to convert all zeros to ones in a binary array eff…
平方数组的数目
Count the number of squareful arrays from the given list of integers by checking adjacent pairs' sums for perfect square…
合并石头的最低成本
Minimize the cost to merge stones with k consecutive piles using dynamic programming to achieve the optimal solution.
网格照明
Grid Illumination uses an array scanning approach with hash lookups to check illuminated cells in a large grid based on …
至少有 1 位重复的数字
Solve Numbers With Repeated Digits by counting unique-digit numbers up to n, then subtracting from n using digit DP.
从先序遍历还原二叉树
Recover a binary tree from its preorder traversal string by tracking node depth and reconstructing child relationships e…
字符流
Implement a StreamChecker that detects if any suffix of a character stream matches a given list of words using efficient…
逃离大迷宫
The 'Escape a Large Maze' problem involves navigating a massive grid with blocked squares and finding if a target can be…
最长重复子串
Find the longest duplicated substring in a string using binary search, sliding window, and rolling hash techniques.
元素和为目标值的子矩阵数量
Count all non-empty submatrices in a given matrix whose elements sum exactly to the target using efficient scanning tech…
最短公共超序列
Compute the shortest string containing both given strings as subsequences using state transition dynamic programming eff…
山脉数组中查找目标值
Find in Mountain Array requires locating a target using binary search over a peak-structured array efficiently in intera…
花括号展开 II
Solve Brace Expansion II efficiently by using stack-based state management to generate all unique combinations of nested…
解析布尔表达式
Solve the "Parsing A Boolean Expression" problem by evaluating boolean expressions using stack-based state management, r…
最小的必要团队
Find the smallest subset of people covering all required skills using bitmask dynamic programming for efficient state tr…
段式回文
Solve the "Longest Chunked Palindrome Decomposition" problem by using dynamic programming and string manipulation techni…
子数组中占绝大多数的元素
Efficiently find the majority element in any subarray using a data structure optimized for multiple range queries.
按字典序排在最后的子串
Identify the lexicographically last substring in a string using two-pointer scanning with invariant tracking efficiently…
餐盘栈
Design a system that manages dinner plate stacks using stack-based state management, handling dynamic plate placement an…
猜字谜
Solve the "Number of Valid Words for Each Puzzle" problem with array scanning and hash lookup to efficiently count valid…
使数组严格递增
Determine the minimum operations to transform arr1 into a strictly increasing sequence using values from arr2 efficientl…
查找集群内的关键连接
Find critical connections in a network of servers, ensuring efficient traversal using depth-first search and Tarjan's al…
项目管理
Sort items into groups while respecting dependencies using graph indegree tracking and topological ordering patterns eff…
设计跳表
Implement a Skiplist efficiently using linked-list pointer manipulation to support search, add, and erase operations in …
穿过迷宫的最少移动次数
Find the minimum moves for a 2-cell snake to reach the bottom-right corner using rotations and BFS traversal in a grid.
统计元音字母序列的数目
Count Vowels Permutation requires computing the number of valid vowel strings of length n using state transition dynamic…
掷骰子模拟
Calculate all valid sequences of n dice rolls with consecutive roll constraints using state transition dynamic programmi…
最大相等频率
Find the longest prefix of an array where removing one element makes all numbers appear equally, using efficient hash tr…
规划兼职工作
Compute the maximum profit from non-overlapping jobs using state transition dynamic programming with sorted arrays and b…
铺瓷砖
Tiling a Rectangle with the Fewest Squares problem asks for the minimum number of squares required to cover a rectangle …
检查「好数组」
Determine if a given array of positive integers can generate 1 using integer multiples of any subset, leveraging number …
得分最高的单词集合
Calculate the highest total score by selecting words from a list using available letters, respecting individual letter s…
推箱子
Solve the minimum moves to push a box to its target using BFS and priority handling in a grid-based warehouse layout eff…
停在原地的方案数
Compute the exact number of ways to remain at index 0 after given steps using state transition dynamic programming.
分割回文串 III
Find the minimal character changes to split a string into k palindromes using precise dynamic programming state transiti…
转化为全零矩阵的最少反转次数
Compute the minimum flips to convert a binary matrix to zero by toggling cells and neighbors using array scanning plus h…
下降路径最小和 II
Find the minimum sum of a falling path in a square matrix using dynamic programming while avoiding same-column selection…
网格中的最短路径
Find the shortest path in a grid with obstacles, allowing the elimination of up to k obstacles using BFS.
你能从盒子里获得的最大糖果数
Collect maximum candies from boxes by exploring initially available boxes and using keys to unlock additional ones effic…
最大得分的路径数目
Calculate the maximum score path and count all valid routes in a square board with obstacles using dynamic programming.
口算难题
Check if a verbal arithmetic equation can be solved using a valid digit-letter mapping.
让字符串成为回文串的最少插入次数
The problem asks to find the minimum number of insertions to convert a string into a palindrome using dynamic programmin…
不同的循环子字符串
Count the distinct non-empty substrings of a given string that can be formed as the concatenation of a string with itsel…
二指输入的的最小距离
Calculate the minimum total distance to type a word using two fingers on a keyboard, applying dynamic programming.
灌溉花园的最少水龙头数目
Determine the minimum number of taps to water an entire garden using state transition dynamic programming and interval c…
翻转子数组得到最大的数组值
Maximize the value of an array by reversing a subarray, focusing on greedy choices and invariant validation.
工作计划的最低难度
Schedule jobs into multiple days to minimize the difficulty of the schedule using dynamic programming and state transiti…
跳跃游戏 V
Jump Game V is a hard dynamic programming problem that focuses on maximizing jumps between indices in an array.
跳跃游戏 IV
Jump Game IV requires minimizing steps to reach the last index using jumps across equal values and neighbors efficiently…
参加考试的最大学生数
Calculate the maximum number of students who can take an exam without cheating using state transition dynamic programmin…
多次求和构造目标数组
This problem requires constructing a target array from an array of ones, using multiple sum operations and a priority qu…
有效的快递序列数目
Count all valid pickup and delivery sequences for n orders where deliveries occur after pickups using dynamic programmin…
形成三的最大倍数
Find the largest number divisible by three by selecting and ordering digits optimally using state transition dynamic pro…
使网格图至少有一条有效路径的最小代价
Determine the minimum cost to create at least one valid path from the top-left to bottom-right in a directional grid.
二叉搜索子树的最大键值和
Find the maximum sum of values from any Binary Search Tree (BST) subtree in a binary tree.
T 秒后青蛙的位置
The problem asks for the probability that a frog reaches a target vertex after t seconds in a tree graph.
最大的团队表现值
Maximize the performance of a team by selecting up to k engineers with the highest performance based on speed and effici…
3n 块披萨
Maximize your pizza slice sum from a 3n-sized circular array using state transition dynamic programming efficiently.
最长快乐前缀
Find the longest non-empty prefix of a string that also appears as its suffix, optimizing with rolling hash techniques.
找到所有好字符串
Find all good strings between two given strings without including a specified evil substring using dynamic programming.
做菜顺序
Maximize the sum of like-time coefficients by optimally choosing dishes to prepare in this dynamic programming problem.
石子游戏 III
Stone Game III is a challenging dynamic programming problem based on game theory and state transition logic.
给 N x 3 网格图涂色的方案数
Calculate the number of ways to paint a grid of size n x 3 with distinct adjacent colors using dynamic programming.
恢复数组
Calculate the number of arrays that can be restored from a string of digits where each number is within [1, k].
生成数组
This problem asks to build an array where the maximum element is found using exactly K comparisons, with dynamic program…
带限制的子序列和
Solve the Constrained Subsequence Sum problem using dynamic programming, sliding window, and priority queues to maximize…
每个人戴不同帽子的方案数
Calculate all unique assignments of hats to people using state transition dynamic programming with bitmasking for collis…
有序矩阵中的第 k 个最小数组和
Find the kth smallest sum in a matrix with sorted rows using binary search and a heap-based approach.
切披萨的方案数
This problem challenges you to determine the number of valid ways to cut a pizza into pieces with apples using dynamic p…
数位成本和为目标值的最大数字
Maximize the integer you can paint with given digit costs under a target sum, using dynamic programming to optimize the …
圆形靶内的最大飞镖数量
Maximize the number of darts on a circular dartboard given dart positions and radius.
两个子序列的最大点积
Solve Max Dot Product of Two Subsequences with state transition dynamic programming that enforces a non-empty pairing de…
摘樱桃 II
Maximize cherry collection in a grid using two robots with careful state transition dynamic programming to optimize path…
两个盒子中球的颜色数相同的概率
Compute the probability that two boxes contain the same number of distinct balls using careful combinatorial and DP meth…
粉刷房子 III
Solve Paint House III using state transition dynamic programming to minimize painting costs while forming exact neighbor…
安排邮筒
Allocate k mailboxes to houses along a street minimizing total distance using dynamic programming with state transitions…
树节点的第 K 个祖先
Find the kth ancestor of any node in a tree using efficient binary-tree traversal and dynamic state tracking methods.
找到最小生成树里的关键边和伪关键边
Identify critical and pseudo-critical edges in a weighted graph's minimum spanning tree using Union Find efficiently.
并行课程 II
Determine the minimum semesters to complete all courses with prerequisites using state transition dynamic programming an…
满足不等式的最大值
Max Value of Equation asks to find the maximum value of a specific equation on a set of 2D points using sliding window t…
最多 K 次交换相邻数位后得到的最小整数
Reorder digits using at most k adjacent swaps to produce the smallest possible integer, leveraging greedy selection effi…
石子游戏 IV
Stone Game IV requires predicting the winner using state transition dynamic programming with careful consideration of pe…
服务中心的最佳位置
Find the optimal service center position in a city by minimizing the sum of Euclidean distances to all customers.
最多的不重叠子字符串
Find the maximum number of non-overlapping substrings in a given string, ensuring no two substrings intersect unless one…
找到最接近目标值的函数值
In this problem, you'll use binary search to find the closest value of a mysterious function to a given target.
形成目标数组的子数组最少增加次数
The problem asks for the minimum number of operations to transform an initial array of zeros into a target array using s…
压缩字符串 II
Solve String Compression II with dynamic programming that tracks deletions, run boundaries, and digit-length jumps in co…
最大得分
Find the maximum possible score from two sorted arrays with a dynamic programming approach, leveraging partitioning and …
找出最长的超赞子字符串
Find the maximum-length awesome substring in a numeric string using hash table and bit manipulation for palindrome poten…
切棍子的最小成本
Find the minimum cost to cut a stick into segments at specified positions using dynamic programming and sorting.
吃掉 N 个橘子的最少天数
Find the minimum number of days to eat n oranges using state transition dynamic programming with memoization.
石子游戏 V
In Stone Game V, Alice divides stones into rows to maximize her score, using a dynamic programming approach to try all d…
使陆地分离的最少天数
Find the minimum number of days to disconnect an island in a grid using depth-first search.
将子数组重新排序得到同一个二叉搜索树的方案数
Determine the number of ways to reorder an array to get the same binary search tree (BST) from its insertion order.
统计所有可行路径
This problem requires counting all possible routes between cities using fuel efficiently with state transition dynamic p…
保证图可完全遍历
Maximize the number of edges that can be removed while keeping the graph fully traversable for both Alice and Bob.
检查字符串是否可以通过排序子字符串得到另一个字符串
This problem requires checking if string 's' can be transformed into string 't' using substring sort operations.
奇怪的打印机 II
Solve Strange Printer II by building color dependencies from bounding rectangles and checking whether a topological orde…
连通两组点的最小成本
Compute the minimum cost to fully connect two groups of points using dynamic programming and bitmasking efficiently.
最多可达成的换楼请求数目
Find the maximum number of achievable transfer requests between buildings with constraints on net employee transfers.
找到处理最多请求的服务器
Given k servers and a series of requests, find the busiest server(s) using greedy strategies and efficient server tracki…
可见点的最大数目
Determine the maximum number of points visible from a fixed location within a given angle using a sliding window approac…
使整数变为 0 的最少操作次数
Compute the minimum number of one-bit operations to convert a given integer to zero using state transition dynamic progr…
统计子树中城市之间最大距离
This problem asks you to count subtrees in a tree structure where the maximum distance between any two cities matches sp…
奇妙序列
Implement a Fancy sequence supporting append, addAll, and multAll operations efficiently using cumulative math design te…
带阈值的图连通性
In 'Graph Connectivity With Threshold,' determine if cities are connected based on common divisors exceeding a threshold…
矩阵转换后的排名
Compute a unique rank matrix using graph indegree with topological ordering, ensuring each element reflects its relative…
通过给定词典构造目标字符串的方案数
Calculate the number of ways to form a target string using words of equal length via state transition dynamic programmin…
第 K 条最小指令
Find the kth smallest lexicographic instruction sequence for reaching a destination in a grid using state transition dyn…
通过指令创建有序数组
The problem asks to compute the cost of inserting elements into a sorted array using a series of instructions.
分配重复整数
Determine if you can allocate integers to satisfy customer quantities using state transition dynamic programming techniq…
最大化网格幸福感
Maximize Grid Happiness is a dynamic programming problem focusing on state transitions with bitmasking to maximize happi…
完成所有任务的最少初始能量
Determine the minimum initial energy needed to finish all tasks using a greedy ordering based on required versus actual …
得到山形数组的最少删除次数
Solve the problem of finding the minimum number of removals to make a given array a mountain array using dynamic program…
数组的最小偏移量
Given a positive integer array, repeatedly double or halve elements to minimize the difference between its largest and s…
最小不兼容性
Optimize the sum of incompatibilities when distributing an array into subsets with unique elements.
从仓库到码头运输箱子
Optimize the minimum number of trips to deliver boxes to ports under strict ship constraints using dynamic programming t…
堆叠长方体的最大高度
Maximize the height of stacked cuboids by strategically rotating and stacking them using dynamic programming.
检查边长度限制的路径是否存在
Solve the problem of checking if there exists a path between two nodes under edge length constraints using efficient tec…
得到连续 K 个 1 的最少相邻交换次数
Find the minimum number of adjacent swaps to gather k consecutive ones in a binary array using sliding window logic.
与数组中元素的最大异或值
Solve the Maximum XOR With an Element From Array problem by efficiently finding the maximum XOR for each query using bit…
得到子序列的最少操作次数
Compute the minimum insertions required to transform arr so that target becomes its subsequence using array scanning and…
重构一棵树的方案数
Determine how many distinct rooted trees can be reconstructed from given node pairs using careful traversal and state tr…
完成所有工作的最短时间
Minimize the maximum working time of k workers by optimally assigning jobs, leveraging dynamic programming and bit manip…
猫和老鼠 II
Cat and Mouse II requires determining if the mouse can reach food before being caught using graph and topological orderi…
生成乘积数组的方案数
Determine the number of arrays of size n where the product equals k using prime factorization and combinatorial DP techn…
放置盒子
Optimize the number of boxes touching the floor in a cubic room using binary search to minimize floor occupancy.
分割回文串 IV
The Palindrome Partitioning IV problem asks you to determine if a string can be split into three palindromic substrings.
最多可以参加的会议数目 II
Determine the maximum sum of event values you can collect by attending at most k non-overlapping events using DP.
最接近目标值的子序列和
Find the minimum absolute difference between a target goal and any subsequence sum using optimized dynamic programming a…
一个图中连通三元组的最小度数
Find the minimum degree of a connected trio in a graph using enumeration over nodes and edges.
互质树
Determine the closest coprime ancestor for each node in a tree using efficient traversal and state tracking of node valu…
执行乘法运算的最大分数
Solve the Maximum Score from Performing Multiplication Operations problem using dynamic programming and state transition…
由子序列构造的最长回文串的长度
Maximize Palindrome Length From Subsequences explores dynamic programming to construct the longest palindrome from two s…
车队 II
Car Fleet II involves calculating collision times between cars traveling at different speeds along a one-lane road using…
统计点对的数目
Given a graph with nodes and edges, count pairs of nodes where the degree sum exceeds a given threshold for each query.
使所有区间的异或结果为零
Determine the minimum changes needed in an array so all size-k segments XOR to zero using DP and bit manipulation.
好子数组的最大分数
Maximize the score of a good subarray using binary search to explore the valid answer space with a focus on two-pointer …
N 次操作后的最大分数和
Maximize the score after n operations by selecting pairs from the array and using their GCD with dynamic programming or …
统计异或值在范围内的数对有多少
Count all pairs in an array whose XOR falls within a given range using efficient bit manipulation techniques and a trie …
好因子的最大数目
Solve Maximize Number of Nice Divisors by splitting primeFactors into mostly 3s and using fast modular exponentiation.
得到新鲜甜甜圈的最多组数
Reorder groups to maximize happy customers by using state transition dynamic programming with bitmasking for optimal bat…
序列中不同最大公约数的数目
Given an array of positive integers, find the number of different subsequences' GCDs.
求出 MK 平均值
Find the MKAverage of a stream of integers using a queue-driven approach with efficient state management.
使字符串有序的最少操作次数
Calculate the minimum operations to sort a string using combinatorial math and string manipulation techniques efficientl…
所有数对按位与结果的异或和
Compute the XOR sum of all pairwise ANDs between two integer arrays using array and bitwise math techniques efficiently.
最高建筑高度
Find the maximum building height in a city given height restrictions for specific buildings.
最近的房间
Find the closest hotel room meeting minimum size requirements using binary search over the valid answer space efficientl…
包含每个查询的最小区间
Find the smallest interval containing each query efficiently using binary search.
有向图中最大颜色值
Compute the maximum color frequency along any valid path in a directed graph using topological ordering and dynamic prog…
向下取整数对和
The problem asks to calculate the sum of floor divisions for all pairs in a given integer array, using an efficient meth…
恰有 K 根木棍可以看到的排列数目
Calculate the number of arrangements of n uniquely-sized sticks so exactly k sticks are visible using dynamic programmin…
石子游戏 VIII
Stone Game VIII requires calculating maximum score difference using state transition dynamic programming on prefix sums …
两个数组最小的异或值之和
Minimize the XOR sum of two integer arrays by rearranging elements using dynamic programming and bit manipulation.
准时抵达会议现场的最小跳过休息次数
Solve the problem of minimizing skips while traveling to arrive on time, using dynamic programming and state transitions…
装包裹的最小浪费空间
Minimize the wasted space when packaging items into boxes, considering package and box size constraints.
反转表达式值的最少操作次数
Determine the minimum operations to change a boolean expression's result using state transition dynamic programming effi…
最佳运动员的比拼回合
This problem requires finding the earliest and latest rounds where two players compete using dynamic programming with st…
设计电影租借系统
Implement a movie rental system with efficient search, rent, drop, and report operations using arrays and hash lookups.
统计为蚁群构筑房间的不同顺序
Solve the problem of counting distinct ways to build rooms in an ant colony using dynamic programming and topological or…
最长公共子路径
The Longest Common Subpath problem requires finding the longest subpath shared by all paths in a graph using binary sear…
规定时间内到达终点的最小花费
Minimize the travel cost in a graph while adhering to a time constraint using state transition dynamic programming.
用三种不同颜色为网格涂色
Count the number of ways to paint a grid using three colors while ensuring adjacent cells have different colors.
合并多棵二叉搜索树
This problem asks you to merge multiple BSTs into a single valid BST by performing a series of operations.
查询最大基因差
Find the maximum genetic difference along paths in a tree using array scanning and hash lookups with XOR calculations.
队列中可以看到的人数
Compute how many people each person in a queue can see to their right using efficient stack-based state management.
删除系统中的重复文件夹
Solve Delete Duplicate Folders in System by building a trie, serializing child subtrees, and deleting repeated non-empty…
统计特殊子序列的数目
Learn to count all valid special subsequences in an array using state transition dynamic programming efficiently and cor…
两个回文子字符串长度的最大乘积
Find the maximum product of lengths of two non-overlapping odd-length palindromic substrings using string and rolling ha…
找出到每个位置为止最长的有效障碍赛跑路线
Compute the longest valid obstacle course at each position using binary search and careful array tracking techniques eff…
你能穿过矩阵的最后一天
Find the last day to walk from top to bottom in a flooded matrix by using binary search and graph traversal techniques.
划分数字的方案数
Calculate the number of valid non-decreasing integer sequences from a string using state transition dynamic programming …
从子集的和还原数组
Reconstruct an array from given subset sums using divide and conquer approach and leveraging array properties.
不同的好子序列数目
Find the number of unique good subsequences of a binary string using dynamic programming and modular arithmetic.
好子集的数目
Find the number of good subsets in an integer array, where each subset's product is the product of distinct primes.
数组的最大公因数排序
The GCD Sort problem challenges you to sort an array using a specific gcd-based swap method.
每棵子树内缺失的最小基因值
Determine the smallest missing genetic value in each subtree using binary-tree traversal and precise state tracking effi…
使数组连续的最少操作数
Find the minimum number of operations to make an array continuous by modifying elements using array scanning and hash lo…
重复 K 次的最长子序列
Find the longest subsequence repeated k times in a string using backtracking search with pruning.
解出数学表达式的学生分数
Calculate student scores for a single-digit math expression using state transition dynamic programming to track all vali…
分割数组的最多方案数
Determine the maximum number of ways to split an array into equal sums using at most one element change, leveraging pref…
含特定字母的最小子序列
Find the lexicographically smallest subsequence of length k with at least repetition occurrences of a given letter using…
将数组分成两个数组并最小化数组和的差
Partition an integer array into two equal halves to minimize the absolute difference of their sums using dynamic program…
两个有序数组的第 K 小乘积
Find the kth smallest product from two sorted arrays using binary search across possible product values efficiently.
到达目的地的第二短时间
Find the second minimum time to reach a destination using BFS while accounting for traffic signal delays in a graph trav…
并行课程 III
Solve Parallel Courses III by finding the minimum number of months to complete all courses using graph-based topological…
棋盘上有效移动组合的数目
Given a set of pieces on a chessboard, calculate the number of valid move combinations without overlap using backtrackin…
同源字符串检测
Determine if there exists an original string that could produce both encoded inputs using state transition dynamic progr…
最大化一张图中的路径价值
Calculate the maximum path quality in a graph using backtracking and pruning to optimize node visits within time limits …
你可以安排的最多任务数目
Maximize the number of tasks that can be completed by efficiently using workers and magical pills.
处理含限制条件的好友请求
Determine which friend requests can be accepted without violating direct or indirect restrictions using union-find logic…
k 镜像数字的和
This problem requires finding the sum of the n smallest k-mirror numbers by generating palindromes in base-k and base-10…
统计农场中肥沃金字塔的数目
Solve Count Fertile Pyramids in a Land with matrix DP that measures the tallest pyramid rooted at each fertile cell.
找出知晓秘密的所有专家
Find all people who receive a secret through meetings using graph traversal with depth-first search efficiently and corr…
合法重新排列数对
Given pairs of numbers, find a valid arrangement where each pair follows a specific condition.
序列顺序查询
Track rankings of locations with names and scores, adding new locations and retrieving top-ranked ones efficiently.
摘水果
Compute the maximum fruits collectable on an infinite line by moving at most k steps from a start position efficiently.
使数组 K 递增的最少操作次数
This problem requires finding the minimum number of operations to make an array K-increasing using binary search over th…
一个区间内所有数乘积的缩写
Calculate the abbreviated product of integers in a range efficiently using math-driven analysis of trailing zeros and si…
还原原数组
Recover the Original Array helps you understand how to reverse-engineer an array from two subsets using array scanning a…
参加会议的最多员工数
Determine the maximum employees to invite based on favorite adjacency constraints using graph indegree and topological o…
用邮票贴满网格图
Determine if a binary grid can be fully covered using fixed-size stamps by applying a greedy placement and validation st…
全部开花的最早一天
Find the earliest day where all flower seeds are blooming based on their planting and growth times, using a greedy strat…
同时运行 N 台电脑的最长时间
Solve the problem of determining the maximum running time of n computers using a set of batteries.
分隔长廊的方案数
Calculate the number of ways to split a corridor into sections with exactly two seats using dynamic programming efficien…
基于陈述统计最多好人数
Determine the maximum number of good people in a group given mutual statements, using precise backtracking with pruning.
查找给定哈希值的子串
Locate the first substring of length k whose rolling hash matches the given hashValue using a sliding window approach.
字符串分组
Group words into connected sets using operations on characters with string and bit manipulation techniques.
删除元素后和的最小差值
Minimize the difference between sums after removing n elements from a 3n array by dividing the remaining elements into t…
移除所有载有违禁货物车厢所需的最少时间
Determine the minimum time to remove all cars with illegal goods using state transition dynamic programming efficiently.
数组的最大与和
Find the maximum AND sum by placing integers into limited slots using state transition dynamic programming efficiently.
统计数组中好三元组数目
Count Good Triplets in an Array requires tracking index orders across two permutations efficiently using binary search.
统计可以被 K 整除的下标对数目
Count Array Pairs Divisible by K requires counting index pairs whose products are divisible by a given number k.
完成比赛的最少时间
Minimize the time to complete a race with tire swaps using dynamic programming and state transitions.
得到回文串的最少操作次数
The problem challenges you to find the minimum number of adjacent swaps to make a string a palindrome.
替换数组中的非互质数
Replace Non-Coprime Numbers in Array uses stack-based state management to iteratively merge adjacent non-coprime integer…
包含要求路径的最小带权子图
Find the minimum weighted subgraph that connects three specified nodes in a directed graph with constraints.
用地毯覆盖后的最少白色砖块
Find the minimum number of white tiles visible after optimally placing carpets using state transition dynamic programmin…
由单个字符重复的最长子字符串
Solve Longest Substring of One Repeating Character by maintaining mergeable run information under character updates afte…
从栈中取出 K 个硬币的最大面值和
Optimize coin selection across multiple piles using state transition dynamic programming to achieve the maximum wallet v…
构造字符串的总得分和
Calculate the sum of scores of built strings by analyzing longest common prefixes with suffixes in a string using effici…
加密解密字符串
The 'Encrypt and Decrypt Strings' problem involves creating a data structure that can encrypt and decrypt strings using …
花园的最大总美丽值
Determine the maximum total beauty of gardens by strategically planting flowers using binary search over achievable flow…
节点序列的最大得分
Find the maximum score of a valid node sequence in an undirected graph with given node scores and edges.
相邻字符不同的最长路径
Find the longest path in a tree where adjacent nodes have different characters using graph DFS and topological reasoning…
花期内花的数目
Find the number of flowers in full bloom at the given times for a list of people.
逃离火灾
Maximize the time you can stay at your starting position before moving to safely reach the safehouse while avoiding fire…
字符串的总引力
Calculate the total appeal of all substrings by counting distinct characters efficiently using state transition DP and h…
检查是否有合法括号字符串路径
Check if there exists a valid parentheses string path in a given grid using state transition dynamic programming.
最大波动的子字符串
Find the largest variance possible in any substring of a given string using dynamic programming.
统计区间中的整数数目
Design and implement a data structure to efficiently add intervals and count the total number of integers covered by the…
巫师的总力量和
The Sum of Total Strength of Wizards problem asks for the sum of the total strengths of all contiguous subarrays of wiza…
以组为单位订音乐会的门票
Design a ticketing system to allocate concert seats in specific groupings while efficiently handling seat reservations.
到达角落需要移除障碍物的最小数目
Find the minimum obstacles to remove in a 2D grid to reach the bottom-right corner using BFS graph traversal techniques.
设计一个文本编辑器
Design a text editor that supports text manipulation and cursor navigation operations efficiently with linked-list-based…
替换字符后匹配
Determine if a target substring can appear in a string after optional character replacements using given mappings effici…
统计得分小于 K 的子数组数目
Count all non-empty subarrays whose score, defined as sum times length, is strictly less than a given integer k efficien…
公司命名
The "Naming a Company" problem requires determining the number of valid distinct company names from a list of name ideas…
卖木头块
Maximize your profit by cutting a wooden piece into smaller parts based on given prices and dimensions.
不同骰子序列的数目
Calculate the number of distinct sequences of dice rolls based on specific conditions using dynamic programming.
拼接数组的最大分数
Maximize the score of two arrays by splicing and swapping a subarray using dynamic programming.
从树中删除边的最小分数
Compute the minimum score after removing two edges in a tree using DFS and XOR-based component tracking efficiently.
网格图中递增路径的数目
Solve Number of Increasing Paths in a Grid by turning cell comparisons into a DAG and counting paths with topological DP…
元素值大于变化阈值的子数组
Find the size of a subarray with all elements greater than threshold divided by length using stack-based state managemen…
统计理想数组的数目
This problem involves counting the number of ideal arrays of a given length under certain conditions using state transit…
使数组可以被整除的最少删除次数
Find the minimum number of deletions to make the smallest element in nums divide all elements of numsDivide.
不可能得到的最短骰子序列
Find the shortest subsequence that cannot be formed from a sequence of dice rolls, with efficient array scanning and has…
优质数对的数目
Calculate the number of excellent pairs in an array using bit counting, hash sets, and efficient pair scanning technique…
图中的最长环
The problem asks to find the longest cycle in a directed graph with specific edge constraints.
将数组排序的最少替换次数
Minimize the number of operations to make the array sorted in non-decreasing order by replacing elements with sums of tw…
统计特殊整数
Count the number of special integers in the interval [1, n] where digits of each integer are distinct.
删除操作后的最大子段和
Calculate the maximum segment sum after sequential removals using array plus union find for efficient merging of segment…
找出数组的第 K 大和
Find the K-Sum of an Array requires computing the kth largest subsequence sum in an array using sorting and heap techniq…
给定条件下构造矩阵
Solve the matrix-building problem by using graph indegree and topological sorting to satisfy given row and column constr…
预算内的最多机器人数目
Determine the maximum number of consecutive robots you can operate without exceeding a given budget using efficient bina…
会议室 III
Determine which meeting room holds the most meetings by simulating room assignments with precise time tracking.
最长递增子序列 II
Determine the longest increasing subsequence in an array where consecutive elements differ by at most k using dynamic pr…
完成所有交易的初始最少钱数
Find the minimum money required to complete all transactions in any order while considering cost and cashback.
字符串的前缀分数和
The 'Sum of Prefix Scores of Strings' problem involves calculating prefix scores for strings based on their occurrences …
好路径的数目
Count all good paths in a tree by scanning node values and using hash maps to track valid connections efficiently.
满足不等式的数对数目
Count pairs in two arrays satisfying a given inequality condition using binary search over the valid answer space.
对字母串可执行的最大删除数
Find the maximum number of deletions on a string using state transition dynamic programming and rolling hash techniques …
矩阵中和能被 K 整除的路径
Compute all paths in a matrix where the sum of elements is divisible by k using state transition dynamic programming eff…
创建价值相同的连通块
Maximize the number of components in a tree with equal sums by carefully deleting edges using divisor-based logic.
统计定界子数组的数目
Count all subarrays where the minimum and maximum match given bounds using efficient sliding window tracking techniques.
使数组相等的最小开销
Find the minimum cost to make all elements of an array equal by using binary search over valid answers.
使数组相似的最少操作次数
Determine the minimum operations to make two arrays similar by adjusting pairs while respecting element frequencies and …
下一个更大元素 IV
Find the second greater integer for each element in an array using binary search and monotonic stack techniques.
移除子树后的二叉树高度
Compute the height of a binary tree efficiently after removing subtrees, using traversal and precomputed node state trac…
最小移动总距离
Optimize the total distance traveled by robots to factories using dynamic programming, sorting, and state transitions.
根据限制分割消息
Split Message Based on Limit requires dividing a string into parts with length constraints using a calculated suffix pat…
不重叠回文子字符串的最大数目
Find the maximum number of non-overlapping palindromic substrings of at least length k in a string using dynamic program…
完美分割的方案数
The problem involves finding the number of beautiful partitions in a string with dynamic programming and state transitio…
统计回文子序列数目
Count the number of palindromic subsequences of length 5 in a given string of digits.
统计中位数为 K 的子数组
Count the number of subarrays in a given array with median equal to a specified value k.
将节点分成尽可能多的组
Determine the maximum number of groups nodes can form in a graph using depth-first traversal without violating edge conn…
让数组不相等的最小总代价
Calculate the minimum cost to rearrange nums1 so that no element matches nums2 using optimal swaps and hash counting.
矩阵查询可获得的最大分数
Solve the Maximum Number of Points From Grid Queries problem using two-pointer scanning and invariant tracking.
添加边使所有节点度数都为偶数
Determine if it's possible to add at most two edges to make all node degrees even in an undirected graph.
查询树中环的长度
Solve the problem of determining cycle lengths in a binary tree with added edges through queries.
统计同位异构字符串数目
Learn to count distinct anagrams for a multi-word string using hash tables, math, and combinatorics efficiently.
好分区的数目
Calculate the number of great partitions of an array using state transition dynamic programming with careful sum constra…
最大化城市的最小电量
Determine the maximum minimum power a city can achieve by strategically adding power stations using binary search and pr…
过桥的时间
Time to Cross a Bridge involves simulating worker movements using arrays and heaps to determine when the last worker cro…
最大价值和与最小价值和的差值
Compute the maximum difference between any path price sum in a tree using binary-tree traversal and state tracking effic…
判断一个点是否可以到达
Determine if a target point is reachable from (1,1) using math-based moves following number theory rules efficiently.
拆分数组的最小代价
Minimize the cost of splitting an array into k subarrays by calculating importance values and applying dynamic programmi…
将珠子放入背包中
The "Put Marbles in Bags" problem challenges you to distribute marbles into bags for maximum score difference using gree…
统计上升四元组
Given a permutation of numbers, count the number of increasing quadruplets using dynamic programming.
重排水果
Solve the problem of rearranging fruit baskets by comparing fruit costs and minimizing swaps using array scanning and ha…
最少得分子序列
Find the minimum score of a string by removing characters from t while maintaining subsequence validity with s.
更新数组后处理求和查询
Solve the Handling Sum Queries After Update problem using arrays and segment trees with lazy propagation for efficiency.
找出对应 LCP 矩阵的字符串
Determine the lexicographically smallest string matching a given LCP matrix using state transition dynamic programming.
在网格图中访问一个格子的最少时间
Compute the fastest path in a grid where each cell has a minimum time requirement using BFS and priority queue technique…
统计可能的树根数目
Given a tree and a set of guesses, find how many nodes can be the root while satisfying the guess constraints.
分割数组使乘积互质
Find the smallest index to split an array so that the products of two parts are coprime using array scanning and hash lo…
获得分数的方法数
Find the number of ways to earn exactly target points using multiple types of exam questions with distinct marks.
完成所有任务的最少时间
Determine the minimum active time for a computer to complete all scheduled tasks within their specific time windows effi…
收集树中金币
The "Collect Coins in a Tree" problem requires traversing a tree to collect coins in the fewest steps while returning to…
图中的最短环
Find the shortest cycle in a bi-directional graph using BFS for optimal traversal.
最少翻转操作数
Find the minimum number of operations to move a 1 in an array from a given start position to other positions, considerin…
网格图中最少访问的格子数
Determine the minimum number of cells to visit in a grid using state transition dynamic programming and efficient traver…
记忆函数 II
Implementing a memoized function ensures that identical inputs avoid redundant calls, boosting efficiency and performanc…
设计可以求最短路径的图类
Implement a dynamic weighted directed graph with efficient shortest path queries and edge additions in real time.
最小化旅行的价格总和
Calculate the minimum total cost of multiple trips on a tree by selectively halving node prices using DFS frequency coun…
设计可取消函数
Master designing cancellable functions with generators, handling promise flow, cancellation, and error propagation effec…
将数组清空
Solve the "Make Array Empty" problem using binary search to determine the minimum number of operations required.
字典序最小的美丽字符串
Find the lexicographically smallest beautiful string larger than the given string using greedy choice and invariant vali…
英雄的力量
Calculate the total power of all non-empty hero groups using state transition dynamic programming efficiently with sorti…
修改图中的边权
Modify Graph Edge Weights is a graph problem where you adjust edge weights to match a target shortest path distance.
最大公约数遍历
Determine if every index in an array can be reached from any other using traversals based on greatest common divisors.
矩阵中严格递增的单元格数
Find the maximum number of cells that can be visited in a matrix by following strictly increasing values from a starting…
统计整数数目
Count of Integers challenges you to find the number of integers with a digit sum between a given range using dynamic pro…
找到矩阵中的好子集
Find a Good Subset of the Matrix is a challenging problem involving array scanning, hash lookup, and bit manipulation to…
最大和查询
Find the maximum sum of paired elements from two arrays under query constraints using efficient binary search techniques…
给墙壁刷油漆
Compute the minimum cost to paint all walls using a paid and free painter with state transition dynamic programming.
机器人碰撞
Robot Collisions involves simulating robot movements and handling collisions with stack-based state management.
所有子数组中不平衡数字之和
Learn how to compute the total imbalance across all subarrays by updating gap counts as each subarray expands.
最长合法子字符串的长度
This problem asks for the longest valid substring of a word that doesn't contain any substrings from a forbidden list.
长度递增组的最大数目
Maximize the number of groups that can be formed with given usage limits, leveraging binary search for optimal solutions…
树中可以形成回文的路径数
This problem asks you to count all node pairs in a tree whose path characters can be rearranged into a palindrome using …
统计范围内的步进数字数目
Count the stepping numbers in a range using dynamic programming with state transitions between digits.
使数组和小于等于 x 的最少时间
Calculate the minimum seconds to reduce the array sum to at most x using optimal single-time reductions per index effici…
子序列最大优雅度
Maximize elegance of a k-length subsequence from a list of items with profits and categories.
操作使得分最大
Maximize the score by applying operations on a subarray at most k times, utilizing stack-based state management.
范围中美丽整数的数目
Count all integers in a given range that have equal even and odd digits and are divisible by k using DP.
使子序列的和等于目标的最少操作次数
The problem requires finding the minimum number of operations to form a subsequence summing to a target using powers of …
在传球游戏中最大化函数值
Maximize the total score in a ball-passing game by selecting the best starting player using state transition dynamic pro…
统计一个字符串的 k 子序列美丽值最大的数目
Determine the number of k-length unique subsequences in a string that maximize the sum of character frequencies efficien…
边权重均等查询
Find the minimum number of operations to equalize edge weights in a tree between given pairs of nodes.
字符串转换
Find how many ways string s can be transformed into string t in exactly k operations using suffix rotations.
可以到达每一个节点的最少边反转次数
This problem requires solving a graph traversal with edge reversals to ensure every node is reachable in a tree-like str…
完全子集的最大元素和
Given a 1-indexed array, select a subset where indices' product is a perfect square, then return the maximum sum.
统计树中的合法路径数目
Count Valid Paths in a Tree involves finding paths with exactly one prime number in a tree of n nodes.
可以被 K 整除连通块的最大数目
Determine the maximum number of connected components in a tree where each component sum is divisible by k using DFS.
有向图访问计数
Count Visited Nodes in a Directed Graph uses dynamic programming to solve graph traversal and node visitation counting e…
对数组执行操作使平方和最大
Maximizing the sum of squares in an array through bitwise operations on selected elements.
和带限制的子多重集合的数目
This problem asks you to count the number of sub-multisets within a given array that have a sum in a specified range.
得到 K 个半回文串的最少修改次数
Minimize the number of letter changes to partition a string into k semi-palindromes using dynamic programming and two po…
子数组不同元素数目的平方和 II
Compute the sum of squares of distinct elements in all subarrays using state transition dynamic programming efficiently.
收集所有金币可获得的最大积分
Find the maximum points after collecting coins from all nodes of a tree using binary-tree traversal and state tracking.
平衡子序列的最大和
Learn to find the maximum sum of a balanced subsequence using dynamic programming and careful state transitions efficien…
购买物品的最大开销
Maximize spending by carefully choosing the right items across multiple shops over m * n days.
找出强数对的最大异或值 II
Find the maximum XOR among strong pairs in an array using array scanning and hash-based lookups efficiently.
找到 Alice 和 Bob 可以相遇的建筑
Determine the leftmost building where Alice and Bob can meet using a binary search over valid move sequences.
找到最大非递减数组的长度
Solve Find Maximum Non-decreasing Array Length with prefix-sum DP transitions that maximize kept segments while preservi…
统计美丽子字符串 II
Count Beautiful Substrings II focuses on finding beautiful substrings with hash tables and number theory techniques.
统计完全子字符串
Count Complete Substrings involves finding substrings where each character appears exactly k times with constraints on a…
统计感冒序列的数目
Calculate all valid infection sequences in a line by using array positions and combinatorial math efficiently for n peop…
关闭分部的可行集合数目
Calculate all valid sets of branch closures while keeping remaining branches within maxDistance using bitmask and graph …
统计好分割方案的数目
Calculate how many ways to partition an array into contiguous subarrays where no number repeats across segments using ha…
执行操作使频率分数最大
Maximize the frequency score by applying up to k operations on a sorted array using binary search over valid answer spac…
统计移除递增子数组的数目 II
Count the number of incremovable subarrays where removal of the subarray results in a strictly increasing array.
树中每个节点放置的金币数目
Determine the exact number of coins to place on each tree node using subtree cost products and DFS tracking.
转换字符串的最小成本 II
Compute the minimum cost to transform source into target using substring replacements with given costs efficiently using…
回文串重新排列查询
Given a string and queries, check if rearranging specified substrings can make the string a palindrome.
统计强大整数的数目
Count the number of powerful integers in a given range by applying state transition dynamic programming with constraints…
执行操作后的最大分割数量
Maximizing the number of partitions in a string after changing one character and applying partitioning operations using …
找出数组中的美丽下标 II
Find Beautiful Indices in the Given Array II challenges you to use binary search and string matching techniques.
将数组分成最小总代价的子数组 II
This problem asks to divide an array into subarrays with a minimal cost and certain constraints on subarray positions.
按距离统计房屋对数目 II
Count the Number of Houses at a Certain Distance II is a graph problem that requires efficient pair counting with an add…
给定操作次数内使剩余元素的或值最小
Minimize the bitwise OR of the remaining elements of an array after applying at most k operations.
人员站位的方案数 II
Calculate all valid placements of people on a 2D grid ensuring Alice can fence herself with Bob without enclosing others…
将单词恢复初始状态所需的最短时间 II
The problem asks to calculate the minimum time required to revert a string to its initial state using specific operation…
匹配模式数组的子数组数目 II
Count subarrays matching a pattern of relative values using array transformation and rolling hash techniques.
修改数组后最大化数组中的连续元素数目
Solve Maximize Consecutive Elements in an Array After Modification by sorting and using state transition DP on value and…
统计前后缀下标对 II
Count the number of index pairs in a string array where one word is both a prefix and suffix of another using array and …
标记所有下标的最早秒数 II
This problem asks to determine the earliest second at which all indices in an array can be marked using a sequence of op…
最大节点价值之和
Solve Find the Maximum Sum of Node Values by tracking XOR gain parity, not by simulating edge operations across the tree…
将元素分配到两个数组中 II
Distribute elements into two arrays based on conditions, utilizing a Binary Indexed Tree for efficient counting and simu…
K 个不相交子数组的最大能量值
Solve Maximum Strength of K Disjoint Subarrays with dynamic programming that tracks segment state, sign changes, and wei…
求出所有子序列的能量和
Find the sum of the power of all subsequences of an integer array where their sum equals a given number.
拾起 K 个 1 需要的最少行动次数
Find the minimum number of moves to pick exactly k ones from a binary array, considering a constraint on changes.
最长公共后缀查询
Find the index of the string in wordsContainer with the longest common suffix for each query efficiently using array and…
求出所有子序列的能量和
Compute the sum of powers for all subsequences of length k using state transition dynamic programming efficiently.
最小化曼哈顿距离
Compute the minimum maximum Manhattan distance by removing one point using array math and geometry insights efficiently.
带权图里旅途的最小代价
Find the minimum cost walk in a weighted graph using array and bit manipulation techniques for efficient path calculatio…
边界元素是最大值的子数组数目
Count the subarrays where the first and last elements are the largest in the subarray, utilizing binary search over vali…
单面值组合的第 K 小金额
Find the kth smallest amount using only one coin denomination at a time, applying binary search efficiently over possibl…
划分数组得到最小的值之和
Solve the problem of dividing an array into subarrays to match specified bitwise AND values using dynamic programming.
最短路径中的边
Use two Dijkstra runs to mark exactly which edges can appear on at least one shortest path from 0 to n - 1.
找出所有稳定的二进制数组 II
Compute the number of stable binary arrays using state transition dynamic programming with exact zero, one, and limit co…
找出唯一性数组的中位数
Given a nums array, find the median of its uniqueness array by considering all subarrays and their distinct element coun…
使数组中所有元素相等的最小开销
Compute the minimum cost to make all elements equal using selective operations guided by greedy choices and invariant ch…
大数组元素的乘积
Solve queries on a massive array of powers of two using binary search to efficiently compute modular products of subarra…
找出分数最低的排列
Determine the lexicographically smallest permutation of nums that minimizes a cyclic score using state transition DP tec…
到达第 K 级台阶的方案数
Determine the total number of ways to reach the k-th stair using a state transition dynamic programming approach with co…
物块放置查询
Determine if blocks can be placed on an infinite number line using queries, leveraging binary search over the valid answ…
不包含相邻元素的子序列的最大和
Compute the maximum sum of a subsequence where no two adjacent elements are selected after each array update efficiently…
找到按位或最接近 K 的子数组
Find a subarray with bitwise OR closest to a given value k with minimal absolute difference.
求出最长好子序列 II
Determine the maximum length of a good subsequence in an integer array using array scanning and hash lookup efficiently.
执行操作可获得的最大总奖励 II
Maximize your total reward using dynamic programming with state transitions in this challenging problem involving array …
数组中的峰值
Determine peaks in a dynamic integer array using efficient Binary Indexed Tree updates and range queries for fast result…
统计逆序对的数目
Count the number of valid permutations satisfying inversion constraints using state transition dynamic programming.
包含所有 1 的最小矩形面积 II
Find the minimum area to cover all 1's in a 2D binary grid using three non-overlapping rectangles.
合并两棵树后的最小直径
Calculate the minimum diameter after merging two trees by strategically connecting nodes to minimize the longest path in…
子数组按位与值为 K 的数目
The problem asks to find the number of subarrays with a given AND value in an array, utilizing binary search for optimiz…
最小代价构造字符串
This problem asks you to construct a target string using given words at minimal cost using dynamic programming technique…
切蛋糕的最小总开销 II
Solve Minimum Cost for Cutting Cake II by choosing optimal cuts using a greedy strategy while tracking cost increments p…
网格图操作后的最大分数
Maximize your score by choosing the optimal sequence of column operations on a grid using dynamic programming transition…
使数组等于目标数组所需的最少操作次数
This problem requires calculating the minimum number of operations to transform one array into another using state trans…
判断矩形的两个角落是否可达
Determine if there is a valid path from the bottom-left to top-right of a rectangle while avoiding circles.
标记所有节点需要的时间
Calculate the time taken to mark all nodes in a tree, starting from any node with time t=0.
新增道路查询后的最短距离 II
The problem involves calculating the shortest path from city 0 to city n-1 after each road addition, leveraging greedy c…
交替组 III
Solve Alternating Groups III using array manipulation and a binary indexed tree to track maximal alternating sequences e…
单调数组对的数目 I
Compute the number of monotonic pairs in an integer array using state transition dynamic programming efficiently.
单调数组对的数目 II
This problem involves finding the count of monotonic pairs in an array using dynamic programming and combinatorics techn…
放三个车的价值之和最大 I
Maximize the value sum by placing three rooks on a chessboard while ensuring they do not attack each other.
放三个车的价值之和最大 II
Maximize the sum by placing three non-attacking rooks on a chessboard with dynamic programming.
找出最大的 N 位 K 回文数
Compute the largest n-digit integer divisible by k that forms a palindrome using state transition dynamic programming te…
统计满足 K 约束的子字符串数量 II
Count Substrings That Satisfy K-Constraint II requires finding valid substrings in a binary string based on a k-constrai…
K 次乘运算后的最终数组 II
Optimize the final state of an array after performing k multiplication operations with priority queues.
统计近似相等数对 II
Count the number of almost equal integer pairs in an array using array scanning and hash lookup efficiently.
统计好整数的数目
Count good integers by rearranging digits to form k-palindromic numbers, leveraging hash tables and math techniques.
对 Bob 造成的最少伤害
Minimize the total damage dealt to Bob using power to eliminate enemies efficiently with greedy approach.
选择矩阵中单元格的最大得分
Optimize selection of grid cells using state transition dynamic programming to maximize total sum efficiently.
查询子数组最大异或值
Solve the Maximum XOR Score Subarray Queries problem using state transition dynamic programming for optimal subarray com…
吃掉所有兵需要的最多移动次数
Calculate the maximum number of moves to eliminate all pawns using BFS, bitmasking, and precise array position math effi…
求出数组中最大序列值
Determine the maximum value of a subsequence in an integer array using state transition dynamic programming and bit oper…
最长上升路径的长度
Determine the maximum length of an increasing path in a 2D array using binary search over potential path lengths efficie…
形成目标字符串需要的最少字符串数 II
Compute the minimum number of valid strings from an array needed to construct a given target string efficiently using dy…
统计重新排列后包含另一个字符串的子字符串数目 II
Count Substrings That Can Be Rearranged to Contain a String II involves identifying valid substrings with a sliding wind…
第一个几乎相等子字符串的下标
Locate the first substring in s that is almost equal to pattern by allowing at most one character mismatch efficiently.
找出第 K 个字符 II
Find the K-th character in a string game using bit manipulation and recursion, optimizing performance for large k values…
构造符合图结构的二维矩阵
This problem challenges you to construct a 2D grid from an undirected graph using a given set of edges.
查询排序后的最大公约数
Solve the Sorted GCD Pair Queries problem by efficiently counting and locating GCDs of all array pairs using hash mappin…
安排活动的方案数
Given n performers, x stages, and y scores, calculate the number of possible ways to assign performers and score bands.
统计能获胜的出招序列数
Count The Number of Winning Sequences is a dynamic programming challenge involving state transitions based on Alice’s cr…
计算子数组的 x-sum II
Calculate the x-sum for every k-length subarray using efficient array scanning and hash-based counting techniques.
判断 DFS 字符串是否是回文串
Determine if strings formed by DFS traversal of a tree are palindromes using array scanning and hash lookups efficiently…
找到初始输入字符串 II
Calculate how many potential original strings Alice might have intended to type, considering her clumsy typing behavior.
最大公约数相等的子序列数量
Count all pairs of non-empty subsequences in an integer array whose elements share the same greatest common divisor effi…
字符串转换后的长度 II
Calculate the length of a string after repeated transformations using state transition dynamic programming for large t v…
统计平衡排列的数目
Determine how many distinct permutations of a digit string are balanced using state transition dynamic programming effic…
执行操作后元素的最高频率 II
Determine the maximum frequency of any element after performing limited operations using binary search and sliding windo…
最小可整除数位乘积 II
Find the smallest zero-free number at least as large as num whose digits multiply to a product divisible by t using care…
好子序列的元素之和
Calculate the sum of all good subsequences in an array where consecutive numbers differ by exactly one.
统计小于 N 的 K 可约简整数
This problem challenges you to count the K-reducible numbers less than a given binary integer using dynamic programming.
最小化相邻元素的最大差值
Minimize the maximum adjacent element difference by filling missing values with two chosen numbers.
最多可收集的水果数目
Maximize the number of fruits collected by three children navigating a grid dungeon with dynamic programming.
移除边之后的权重最大和
Maximize the sum of edge weights in a tree after removals, using dynamic programming and tree traversal techniques.
连接两棵树后最大目标节点数目 II
Maximize the number of target nodes after connecting two trees by analyzing their structure and target relationships.
统计最小公倍数图中的连通块数目
Determine the number of connected components in an LCM-based graph using array scanning and hash-based connectivity chec…
用点构造面积最大的矩形 II
Find the largest rectangle on a plane using given points while avoiding any interior points and optimizing with math and…
使字符频率相等的最少操作次数
This Hard problem asks to transform a string so all character frequencies match using minimal deletions, leveraging dyna…
唯一中间众数子序列 I
Count subsequences of size 5 with a unique middle mode in an integer array using hash table and combinatorics.
字符相同的最短子字符串 I
Minimize the length of the longest substring with identical characters after at most numOps changes in a binary string.
字符相同的最短子字符串 II
Find the minimal length of a substring with identical characters using binary search and controlled character flips effi…
统计恰好有 K 个相等相邻元素的数组数目
Count the number of valid arrays with exactly k adjacent elements that are equal, using math and combinatorics technique…
删除所有值为某个元素后的最大子数组和
Maximize Subarray Sum After Removing All Occurrences of One Element involves finding the optimal subarray sum with one a…
不重叠区间的最大得分
Maximize the score of up to 4 non-overlapping intervals, considering their weight and ensuring no overlap between chosen…
统计 K 次操作以内得到非递减子数组的数目
This problem asks you to count non-decreasing subarrays in a given array after applying at most k operations.
最长特殊路径
Compute the longest downward path in a tree with unique node values using DFS, hash lookup, and careful array scanning.
所有安放棋子方案的曼哈顿距离
This problem challenges you to calculate Manhattan distances in all valid arrangements of identical pieces on a grid.
最多 K 个元素的子数组的最值之和
Compute the sum of maximum and minimum values in all subarrays up to size k using efficient stack-based state management…
最短公共超序列的字母出现频率
Compute all unique shortest common supersequences of given words using graph indegree tracking and topological ordering …
变成好标题的最少代价
Solve Minimum Cost Good Caption with dynamic programming that builds minimum edit cost while enforcing character runs of…
使数组包含目标值倍数的最少增量
This problem involves incrementing elements of an array to make sure each target element has at least one multiple in th…
奇偶频次间的最大差值 II
Find the maximum difference between even and odd character frequencies in substrings using sliding window updates effici…
统计可以被最后一个数位整除的子字符串数目
Count the number of substrings in a string divisible by their last non-zero digit using dynamic programming.
最大化游戏分数的最小值
Maximizing the minimum score after at most m moves, leveraging binary search and greedy strategies over an array of scor…
分割正方形 II
Separate Squares II requires finding the minimum y-coordinate such that squares' areas are split evenly above and below …
最短匹配子字符串
Find the shortest substring in a string that matches a pattern with exactly two wildcards efficiently using binary searc…
最长 V 形对角线段的长度
Compute the maximum length of a V-shaped diagonal segment in a 2D integer matrix using state transition dynamic programm…
判断操作后字符串中的数字是否相等 II
Determine if repeated digit-sum operations on a numeric string reduce it to two equal digits using math and string techn…
正方形上的点之间的最大距离
Select k points on a square boundary to maximize minimum Manhattan distance using binary search and greedy placement str…
全排列 IV
Find the k-th alternating permutation of numbers 1 to n, ensuring no adjacent numbers share parity, using array and math…
字典序最小的生成字符串
Generate the lexicographically smallest string by merging str1 and str2 using a greedy approach with invariant checks.
删除一个冲突对后最大子数组数目
Maximize the count of subarrays after removing one conflicting pair using array traversal and segment tree logic efficie…
删除元素后 K 个字符串的最长公共前缀
Find the longest common prefix length of k strings after removing an element in the array.
最长特殊路径 II
Find the longest downward path in a tree where node values are mostly distinct, allowing one repeat, using array scannin…
统计美丽整数的数目
Count Beautiful Numbers using state transition dynamic programming to efficiently calculate valid numbers in a given ran…
使数组元素都变为零的最少操作次数
Minimize operations to reduce array elements to zero, focusing on array manipulation, math, and bit operations for effic…
将数组分割为子数组的最小代价
Optimize array splits with dynamic programming to minimize costs for the Minimum Cost to Divide Array Into Subarrays pro…
操作后最大活跃区段数 II
Maximize the number of active sections in a binary string with at most one trade.
子字符串连接后的最长回文串 II
Compute the longest palindrome by concatenating substrings from two strings using state transition dynamic programming e…
使 K 个子数组内元素相等的最少操作数
Compute the minimum operations to ensure at least k non-overlapping subarrays of size x have all equal elements efficien…
最大化交错和为 K 的子序列乘积
Find the maximum product of a subsequence in an array with an alternating sum equal to a given target.
移除最小数对使数组有序 II
The problem asks to find the minimum number of operations to make an array non-decreasing by removing pairs of elements.
带权树中的最短路径
Solve the Shortest Path in a Weighted Tree using binary-tree traversal and efficient state tracking for queries.
最小回文排列 II
Find the k-th lexicographically smallest palindromic rearrangement of a given palindromic string s.
统计逐位非递减的整数
Count all integers between l and r whose digits never decrease in base b using state transition dynamic programming effi…
求出数组的 X 值 II
The "Find X Value of Array II" problem requires calculating the number of ways to remove a suffix from an array such tha…
有向无环图中合法拓扑排序的最大利润
Solve the Maximum Profit from Valid Topological Order in DAG problem using graph indegree and topological sorting with d…
判断连接可整除性
Find the lexicographically smallest permutation of numbers whose concatenation is divisible by k using state transition …
针对图的路径存在性查询 II
Solve path existence queries in a graph using binary search on the answer space, focusing on sorted nodes and maximum di…
合并得到最小旅行时间
Minimize the total travel time by merging road signs, using dynamic programming to manage state transitions efficiently.
魔法序列的数组乘积之和
Use state transition dynamic programming to count magical index sequences and accumulate weighted products without enume…
子树反转和
This problem involves calculating the maximum possible subtree inversion sum with dynamic programming and binary-tree tr…
图中边值的最大和
Maximize the sum of edge values in a connected graph by assigning unique node values and optimizing edge products.
等和矩阵分割 II
Determine if a matrix can be partitioned into two sections with an equal sum using a single cut.
包含要求路径的最小带权子图 II
Solve the Minimum Weighted Subgraph With the Required Paths II problem by leveraging binary-tree traversal and efficient…
给边赋权值的方案数 II
This problem involves assigning edge weights in a tree and calculating the cost of paths based on these weights.
折扣价交易股票的最大利润
Solve the Maximum Profit from Trading Stocks with Discounts problem using binary-tree traversal and dynamic state tracki…
移除相邻字符后字典序最小的字符串
Find the lexicographically smallest string by repeatedly removing adjacent characters optimally using dynamic programmin…
分割数组后不同质数的最大数目
Compute the maximum number of distinct prime numbers after sequentially updating array elements with efficient preproces…
最大子数组 GCD 分数
Maximize Subarray GCD Score focuses on maximizing a subarray's score by using at most k doubling operations on an array …
最大好子树分数
Find the maximum sum of values in a tree subtree without repeating any digit across selected nodes using DFS and bitmask…
字符串转换需要的最小操作数
Transform word1 into word2 using minimal operations on substrings with a dynamic programming state transition approach.
树中找到带权中位节点
Given a weighted tree and queries, find the weighted median node for each path between two nodes using binary-tree trave…
第 K 小的路径异或和
This problem involves finding the kth smallest distinct XOR sum for nodes in a subtree of a tree structure using binary-…
所有人渡河所需的最短时间
Find the minimum time to transport individuals across a river with dynamic environmental conditions and boat capacity.
升级后最大生成树稳定性
Maximizing the stability of a spanning tree with upgrades requires careful optimization of edge strengths using binary s…
数组的最小稳定性因子
The problem requires finding the minimum stability factor of an array by utilizing binary search and math-based optimiza…
到达目标点的最小移动次数
Find the minimum number of moves to reach a target point from a start point on a 2D grid with a math-driven solution.
用特殊操作处理字符串 II
Solve the problem of processing strings with special operations like '*' and '#' by simulating the rules left-to-right.
图中的最长回文路径
Find the longest path in a graph that forms a palindrome using state transition dynamic programming and bitmask techniqu…
查找具有螺旋学习模式的学生
Solve Find Students with Study Spiral Pattern by validating each student's ordered subject cycle, consistency, and repea…
恢复网络路径
Find the maximum recovery cost of valid paths in a directed acyclic graph where some nodes are offline.
位计数深度为 K 的整数数目 I
Calculate the number of integers in a given range with a specific popcount-depth using state transition dynamic programm…
位计数深度为 K 的整数数目 II
This problem challenges you to efficiently calculate the number of integers with popcount-depth equal to K using array a…
统计梯形的数目 II
Count Number of Trapezoids II requires scanning point pairs and hashing slopes to efficiently find parallel sides in arr…
划分数组得到最大异或运算和与运算之和
Partition the array into three subsequences to maximize XOR and AND operations with a greedy approach.
查询超过阈值频率最高元素
Find the majority element in subarrays that appear at least a threshold number of times, or -1 if none exists.
三段式数组 II
Trionic Array II is a challenging problem involving the sum of contiguous subarrays with special index constraints.
该难度高频题型
Guided Practice Path
AI recommends problems by your level and tracks your progress.
Start Guided Patharrow_forward