LeetCode/Medium

Medium 难度题单

1423 道题目

这一层级用于训练对应强度下的解题稳定性与表达完整度,建议每轮固定复盘复杂度、边界和可替代方案。

训练重点

强调模式识别、状态设计和复杂度平衡。

建议节奏

每轮 3-5 题,先口述思路再写代码,最后复盘错误路径。

搭配建议

结合模式页和题型页同步练,能更快形成可迁移能力。

2

两数相加

Add Two Numbers requires careful linked-list pointer manipulation to sum digits while handling carries efficiently in in…

中等
3

无重复字符的最长子串

Find the length of the longest substring without repeating characters using a sliding window and hash map to track state…

中等
5

最长回文子串

Find the longest contiguous palindromic substring in a given string using dynamic programming and two-pointer expansion …

中等
6

Z 字形变换

Convert a string into a zigzag pattern across multiple rows and read it line by line efficiently for string manipulation…

中等
7

整数反转

Reverse Integer challenges you to invert the digits of a signed 32-bit integer, handling overflow and negative values ca…

中等
8

字符串转换整数 (atoi)

Convert a string to a 32-bit signed integer by carefully parsing characters, handling signs, and ignoring invalid traili…

中等
11

盛最多水的容器

Find two vertical lines that can form a container with the most water in a given array of heights.

中等
12

整数转罗马数字

Convert a given integer to its Roman numeral representation using hash table mapping and decimal place math operations e…

中等
15

三数之和

Given an integer array, return all unique triplets where the sum is zero using two-pointer scanning with careful duplica…

中等
16

最接近的三数之和

Find the sum of three integers in an array that is closest to a given target using two-pointer scanning.

中等
17

电话号码的字母组合

Generate all letter combinations a digit string can represent using backtracking with pruning, leveraging hash table map…

中等
18

四数之和

The 4Sum problem requires finding all unique quadruplets in an array that sum to a specific target value.

中等
19

删除链表的倒数第 N 个结点

Remove the nth node from the end of a linked list using a two-pointer approach to solve efficiently.

中等
22

括号生成

Generate Parentheses requires generating all valid combinations of parentheses with given pairs using backtracking and s…

中等
24

两两交换链表中的节点

Learn how to swap every adjacent linked-list pair by rewiring nodes safely without changing values or breaking the remai…

中等
29

两数相除

Solve Divide Two Integers by turning repeated subtraction into bit-shifted chunk subtraction with careful sign and overf…

中等
31

下一个排列

Next Permutation is a medium-difficulty problem focusing on generating the next lexicographically greater permutation of…

中等
33

搜索旋转排序数组

Find the index of a target in a rotated sorted array using a careful binary search that handles pivot shifts.

中等
34

在排序数组中查找元素的第一个和最后一个位置

Locate the first and last index of a target in a sorted array using binary search for precise O(log n) performance.

中等
36

有效的数独

Check if a 9x9 Sudoku board is valid by scanning rows, columns, and sub-boxes with hash lookups, ensuring no duplicates …

中等
38

外观数列

Count and Say requires building the nth sequence term by iteratively applying a run-length encoding on strings of digits…

中等
39

组合总和

Find all unique combinations of numbers from a distinct array that sum to a target using controlled backtracking search.

中等
40

组合总和 II

Find all unique combinations of numbers that sum to a target using backtracking with careful pruning to avoid duplicates…

中等
43

字符串相乘

Multiply Strings requires simulating integer multiplication using only string operations without direct numeric conversi…

中等
45

跳跃游戏 II

Jump Game II requires finding the minimum jumps to reach the end of an array using dynamic programming and greedy techni…

中等
46

全排列

Generate all possible orderings of a distinct integer array using backtracking search with careful pruning to avoid dupl…

中等
47

全排列 II

Generate all unique permutations of an array containing duplicates using backtracking and pruning to avoid repeated sequ…

中等
48

旋转图像

Rotate an n x n matrix 90 degrees clockwise in-place using array manipulation and mathematical indexing techniques effic…

中等
49

字母异位词分组

Group the anagrams in a list of strings using efficient hash table-based methods, focusing on array scanning.

中等
50

Pow(x, n)

Calculate x to the power n efficiently using recursion and exponentiation, handling negative powers and large inputs saf…

中等
53

最大子数组和

Maximum Subarray is a classic state transition dynamic programming problem about deciding whether to extend or restart a…

中等
54

螺旋矩阵

Given an m x n matrix, return all elements in spiral order starting from the top-left corner.

中等
55

跳跃游戏

Solve the Jump Game problem using state transition dynamic programming to determine if you can reach the last index of t…

中等
56

合并区间

Merge Intervals requires sorting an array of interval pairs and combining overlaps efficiently using sequential comparis…

中等
57

插入区间

Given a sorted array of non-overlapping intervals, insert a new interval and merge any overlapping intervals.

中等
59

螺旋矩阵 II

Generate a spiral matrix of size n x n, filled with elements from 1 to n² in spiral order, for interview-focused solving…

中等
61

旋转链表

Rotate a singly linked list to the right by k positions using careful pointer manipulation and two-pointer traversal tec…

中等
62

不同路径

Calculate the number of unique paths for a robot to move on an m x n grid with only right and down movements.

中等
63

不同路径 II

Calculate the number of unique paths from top-left to bottom-right in a grid with obstacles using dynamic programming st…

中等
64

最小路径和

Compute the minimum sum from top-left to bottom-right in a grid using state transition dynamic programming efficiently.

中等
71

简化路径

Simplify a Unix-style path by transforming it into its canonical form using stack-based state management.

中等
72

编辑距离

Determine the minimum number of insertions, deletions, or replacements to transform one string into another using dynami…

中等
73

矩阵置零

Modify the matrix in place by setting rows and columns to zero when an element is zero.

中等
74

搜索二维矩阵

Search a 2D matrix efficiently using binary search over its linearized index, ensuring correctness in row-major sorted a…

中等
75

颜色分类

Sort Colors requires in-place reordering of an array using a two-pointer scanning strategy to group 0s, 1s, and 2s effic…

中等
77

组合

Generate all combinations of k numbers from the range [1, n] using backtracking and pruning.

中等
78

子集

Generate all subsets of a set of unique integers using backtracking with pruning to avoid duplicates.

中等
79

单词搜索

Solve Word Search with backtracking by exploring adjacent cells to match a target word in a grid.

中等
80

删除有序数组中的重复项 II

Solve the problem of removing duplicates from a sorted array in-place, ensuring each element appears at most twice, usin…

中等
81

搜索旋转排序数组 II

Determine if a target exists in a rotated sorted array that may contain duplicates using a binary search variation effic…

中等
82

删除排序链表中的重复元素 II

Remove duplicates from a sorted linked list, leaving only distinct values, and return the modified list in sorted order.

中等
86

分隔链表

Partition a linked list such that all nodes less than x come before nodes greater than or equal to x while preserving re…

中等
89

格雷编码

Generate an n-bit Gray Code sequence using backtracking with pruning and bit manipulation techniques.

中等
90

子集 II

Subsets II problem asks to generate unique subsets from an array with possible duplicates using backtracking search with…

中等
91

解码方法

Decode Ways is a dynamic programming problem focused on decoding a numeric string to letters using specific mappings.

中等
92

反转链表 II

Reverse a segment of a singly linked list from position left to right using precise pointer manipulation techniques.

中等
93

复原 IP 地址

Restore all valid IP addresses from a string using backtracking with pruning, avoiding invalid segments or leading zeros…

中等
95

不同的二叉搜索树 II

Generate all structurally unique BSTs with values 1 to n using backtracking and recursive tree construction techniques.

中等
96

不同的二叉搜索树

Given n nodes, calculate the number of unique binary search trees (BSTs) that can be formed with values from 1 to n.

中等
97

交错字符串

The Interleaving String problem requires determining if a string can be formed by interleaving two others, utilizing dyn…

中等
98

验证二叉搜索树

Validate Binary Search Tree problem checks if a binary tree satisfies BST properties using tree traversal and state trac…

中等
99

恢复二叉搜索树

Recover a BST where two nodes are swapped by mistake using in-order traversal and careful state tracking to restore corr…

中等
102

二叉树的层序遍历

Perform a level order traversal on a binary tree using BFS to return node values level by level.

中等
103

二叉树的锯齿形层序遍历

Traverse a binary tree in zigzag level order, alternating directions at each depth using BFS and state tracking techniqu…

中等
105

从前序与中序遍历序列构造二叉树

Construct a binary tree using preorder and inorder traversal arrays, leveraging array scanning and hash table lookups.

中等
106

从中序与后序遍历序列构造二叉树

Reconstruct a binary tree from given inorder and postorder arrays using array scanning and hash lookup to optimize recur…

中等
107

二叉树的层序遍历 II

Return a bottom-up level order traversal of a binary tree, processing nodes left to right while tracking each level accu…

中等
109

有序链表转换二叉搜索树

Convert a sorted singly linked list into a height-balanced BST using pointer manipulation and divide-and-conquer recursi…

中等
113

路径总和 II

Find all root-to-leaf paths in a binary tree where the sum of node values equals a given target using DFS backtracking.

中等
114

二叉树展开为链表

Flatten a binary tree into a right-skewed linked list by manipulating pointers following a pre-order traversal, handling…

中等
116

填充每个节点的下一个右侧节点指针

Connect each node across every level by reusing established next links to traverse a perfect binary tree without extra q…

中等
117

填充每个节点的下一个右侧节点指针 II

Populate each next pointer in a binary tree to its immediate right node, handling nulls and uneven levels efficiently us…

中等
120

三角形最小路径和

Given a triangle, return the minimum path sum from top to bottom, moving to adjacent numbers in the row below.

中等
122

买卖股票的最佳时机 II

Maximize stock profit by using a greedy approach to buy and sell multiple times, with state transition dynamic programmi…

中等
128

最长连续序列

Find the length of the longest consecutive elements sequence in an unsorted array using array scanning and hash lookup.

中等
129

求根节点到叶节点数字之和

Calculate the sum of all root-to-leaf numbers in a binary tree where each path represents a number.

中等
130

被围绕的区域

Transform the matrix in-place by marking regions surrounded by 'X' as 'X', while keeping border-adjacent 'O's intact.

中等
131

分割回文串

Find all possible palindrome partitioning of a string using backtracking and dynamic programming.

中等
133

克隆图

Clone Graph involves cloning a graph using DFS, focusing on graph traversal and neighbor management using hash tables.

中等
134

加油站

The Gas Station problem requires finding the starting station index for a full circular trip with gas stations and costs…

中等
137

只出现一次的数字 II

Find the single element in an array where every other element appears three times, using bit manipulation and constant s…

中等
138

随机链表的复制

This problem requires copying a linked list where each node has a random pointer in addition to the next pointer.

中等
139

单词拆分

Determine if a string can be fully segmented into dictionary words using array scanning and hash-based lookups for effic…

中等
142

环形链表 II

Identify the start of a cycle in a linked list using pointer manipulation, efficiently handling edge cases without modif…

中等
143

重排链表

Reorder List requires careful pointer manipulation in a singly linked list to interleave nodes from the ends without alt…

中等
146

LRU 缓存

Implement an efficient LRU Cache using hash table and doubly-linked list to achieve O(1) operations for get and put.

中等
147

对链表进行插入排序

Sort a singly linked list using insertion sort by carefully manipulating pointers to maintain a sorted order efficiently…

中等
148

排序链表

Sort List requires sorting a singly linked list efficiently using pointer manipulation and merge sort for optimal perfor…

中等
150

逆波兰表达式求值

Compute the result of an arithmetic expression in Reverse Polish Notation using a stack to manage operands efficiently.

中等
151

反转字符串中的单词

Reverse Words in a String requires reordering words using precise two-pointer scanning with careful space handling for e…

中等
152

乘积最大子数组

Find the subarray with the largest product in an integer array using dynamic programming techniques.

中等
153

寻找旋转排序数组中的最小值

Find the minimum element in a rotated sorted array using binary search to efficiently identify the point of rotation.

中等
155

最小栈

Design a stack with O(1) operations to push, pop, retrieve the top element, and get the minimum element in constant time…

中等
162

寻找峰值

Find Peak Element leverages binary search for efficiently locating a peak in an array, a problem commonly asked in techn…

中等
164

最大间距

Find the largest difference between successive elements in a sorted array efficiently using linear time techniques and b…

中等
165

比较版本号

Compare two version numbers by checking their individual revisions, considering missing revisions as zero, using a two-p…

中等
166

分数到小数

Convert a fraction into a decimal, handling repeating decimals with parentheses around the repeating part.

中等
167

两数之和 II - 输入有序数组

Solve the Two Sum II problem efficiently using binary search over a valid answer space in a sorted array.

中等
172

阶乘后的零

Given a number n, find how many trailing zeroes are in n! using a math-driven approach.

中等
173

二叉搜索树迭代器

Implement an iterator for in-order traversal of a binary search tree (BST), maintaining traversal state with stack-based…

中等
179

最大数

The problem asks to arrange integers to form the largest possible number, focusing on greedy algorithms and string handl…

中等
187

重复的DNA序列

Solve Repeated DNA Sequences by sliding a length-10 window and tracking seen patterns with a hash set or bitmask.

中等
189

轮转数组

Rotate Array challenges you to shift elements right by k steps using precise two-pointer scanning and invariant tracking…

中等
198

打家劫舍

Maximize the amount of money you can rob tonight without alerting the police by applying dynamic programming with state …

中等
199

二叉树的右视图

The Binary Tree Right Side View problem asks you to return the visible nodes from the right side of a binary tree, trave…

中等
200

岛屿数量

Count the number of distinct islands in a binary grid using array traversal combined with depth-first search exploration…

中等
201

数字范围按位与

Use shared high bits and bit clearing to solve Bitwise AND of Numbers Range without scanning every value.

中等
204

计数质数

Count all prime numbers less than a given integer n using efficient array and math-based enumeration techniques.

中等
207

课程表

Determine if all courses can be completed by analyzing prerequisite dependencies using indegree tracking and topological…

中等
208

实现 Trie (前缀树)

This problem requires designing a Trie (Prefix Tree) to efficiently store and query strings using hash table concepts fo…

中等
209

长度最小的子数组

Find the minimal length of a subarray whose sum is greater than or equal to the target using efficient algorithms.

中等
210

课程表 II

Solve the 'Course Schedule II' problem using graph indegree and topological ordering, utilizing DFS or BFS to find the c…

中等
211

添加与搜索单词 - 数据结构设计

Build a WordDictionary supporting dynamic word addition and search with wildcard matching efficiently using Trie and DFS…

中等
213

打家劫舍 II

Maximize your loot by robbing houses arranged in a circle without alerting the police using dynamic programming.

中等
215

数组中的第K个最大元素

Find the kth largest element in an unsorted array using optimal approaches like Quickselect or heaps.

中等
216

组合总和 III

Find all unique combinations of k numbers adding to n using efficient backtracking with pruning in arrays.

中等
221

最大正方形

Maximal Square is a matrix-based dynamic programming problem that focuses on finding the largest square filled with 1's.

中等
223

矩形面积

Calculate the total area covered by two rectangles using geometry, handling overlaps and avoiding double counting effici…

中等
227

基本计算器 II

Basic Calculator II evaluates a mathematical expression with operators and integers, handling basic arithmetic with prec…

中等
229

多数元素 II

Identify all elements in an integer array appearing more than ⌊ n/3 ⌋ times using efficient array scanning and hash coun…

中等
230

二叉搜索树中第 K 小的元素

Find the kth smallest element in a BST by leveraging in-order traversal to efficiently track node order and count.

中等
235

二叉搜索树的最近公共祖先

Find the lowest common ancestor (LCA) of two nodes in a binary search tree, using binary-tree traversal and state tracki…

中等
236

二叉树的最近公共祖先

Identify the lowest common ancestor of two nodes in a binary tree using traversal and state tracking techniques efficien…

中等
237

删除链表中的节点

Delete Node in a Linked List focuses on pointer manipulation to delete a node in a singly linked list without access to …

中等
238

除了自身以外数组的乘积

Solve the 'Product of Array Except Self' problem by calculating the product of all elements except self for each index e…

中等
240

搜索二维矩阵 II

Efficiently search for a target in a 2D matrix using binary search and matrix properties.

中等
241

为运算表达式设计优先级

Solve Different Ways to Add Parentheses by splitting on each operator and memoizing every subexpression result list.

中等
260

只出现一次的数字 III

Find the two unique numbers in an array where all other numbers appear exactly twice using bit manipulation efficiently.

中等
264

丑数 II

Find the nth ugly number, where ugly numbers have prime factors limited to 2, 3, and 5.

中等
274

H 指数

Determine a researcher's h-index by analyzing citations using array sorting and counting techniques efficiently and accu…

中等
275

H 指数 II

Compute a researcher's H-Index from a sorted citation array using binary search over the valid answer space efficiently.

中等
279

完全平方数

Perfect Squares asks for the least number of perfect squares summing to a given integer n using dynamic programming or B…

中等
284

窥视迭代器

Design an iterator with peek functionality, adding to the standard next and hasNext operations for efficient element acc…

中等
287

寻找重复数

The problem involves finding the duplicate number in an array of integers, using a binary search approach over the valid…

中等
289

生命游戏

Solve the Game of Life by updating each cell based on its eight neighbors using Array and Matrix simulation patterns eff…

中等
299

猜数字游戏

Solve the Bulls and Cows problem using hash tables and string manipulation to track exact and misplaced digits.

中等
300

最长递增子序列

Solve the Longest Increasing Subsequence problem using dynamic programming and binary search to efficiently find the sub…

中等
304

二维区域和检索 - 矩阵不可变

Design a 2D matrix class that efficiently handles sum queries with O(1) time complexity using a prefix sum approach.

中等
306

累加数

Additive Number is solved by trying the first two splits, then pruning aggressively while verifying each required sum in…

中等
307

区域和检索 - 数组可修改

Implement a mutable range sum query using efficient design patterns to handle multiple updates and range sum queries.

中等
309

买卖股票的最佳时机含冷冻期

Maximize stock profit with cooldown restrictions using state transition dynamic programming to track buy, sell, and cool…

中等
310

最小高度树

Identify all roots of a tree that produce minimum height using graph indegree analysis and topological trimming.

中等
313

超级丑数

Compute the nth super ugly number efficiently using dynamic programming with state transitions based on the given prime …

中等
316

去除重复字母

Remove duplicate letters from a string to produce the lexicographically smallest result using stack-based state manageme…

中等
318

最大单词长度乘积

The problem requires finding the maximum product of lengths of two words from an array, where the words don't share comm…

中等
319

灯泡开关

Bulb Switcher challenges you to find how many bulbs remain on after n toggling rounds using a math-based insight.

中等
322

零钱兑换

Find the minimum number of coins needed to reach a target amount using dynamic programming state transitions efficiently…

中等
324

摆动排序 II

Rearrange an array in a way that every odd-indexed element is greater than its adjacent even-indexed elements.

中等
328

奇偶链表

Reorder a singly linked list by grouping odd-indexed nodes first, followed by even-indexed nodes while preserving relati…

中等
331

验证二叉树的前序序列化

Determine if a given string correctly represents a binary tree preorder traversal using state tracking and slot counting…

中等
334

递增的三元子序列

Identify if an array contains a strictly increasing triplet by maintaining a running minimal and middle value efficientl…

中等
337

打家劫舍 III

Maximize the loot by robbing non-adjacent houses in a binary tree structure using dynamic programming and DFS.

中等
341

扁平化嵌套列表迭代器

Implement an iterator to flatten a nested list of integers, accounting for potential nesting levels.

中等
343

整数拆分

Break an integer into the sum of positive integers to maximize the product using dynamic programming.

中等
347

前 K 个高频元素

Find the k most frequent elements from an array using efficient algorithms like hashing and sorting.

中等
355

设计推特

Design Twitter requires implementing post, follow, unfollow, and news feed retrieval using linked-list pointer manipulat…

中等
357

统计各位数字都不同的数字个数

The problem asks to count numbers with unique digits from 0 to 10^n using dynamic programming, math, and backtracking te…

中等
365

水壶问题

Determine if two jugs with given capacities can measure an exact target amount using math and DFS strategies efficiently…

中等
368

最大整除子集

Find the largest subset of distinct positive integers where every pair satisfies divisibility using state transition dyn…

中等
371

两整数之和

Solve the Sum of Two Integers problem using bit manipulation and math to avoid using the operators + and -.

中等
372

超级次方

Compute large exponentiations efficiently using modular arithmetic and divide-and-conquer techniques for this Super Pow …

中等
373

查找和最小的 K 对数字

Find K Pairs with Smallest Sums combines arrays and heap usage to select the smallest sum pairs efficiently.

中等
375

猜数字大小 II

Minimize the maximum cost of guessing a number in a dynamic guessing game using optimal strategies.

中等
376

摆动序列

Find the longest wiggle subsequence in an integer array using state transition dynamic programming with greedy optimizat…

中等
377

组合总和 Ⅳ

Combination Sum IV asks to find the number of combinations that sum to a given target using elements from an array.

中等
378

有序矩阵中第 K 小的元素

Find the kth smallest element in a sorted n x n matrix using efficient binary search or heap strategies for optimized me…

中等
380

O(1) 时间插入、删除和获取随机元素

Implement a data structure supporting insert, delete, and getRandom in average O(1) using array plus hash mapping.

中等
382

链表随机节点

Select a random node from a singly linked list ensuring uniform probability using efficient pointer techniques and reser…

中等
384

打乱数组

Shuffle an Array requires designing a class to randomly permute an integer array while ensuring all permutations are equ…

中等
385

迷你语法分析器

Deserialize a nested list string using stack-based state management, handling integers and nested lists with depth-first…

中等
386

字典序排数

Generate all numbers from 1 to n in lexicographical order using a depth-first search pattern optimized with trie logic f…

中等
388

文件的最长绝对路径

Find the length of the longest absolute file path in a filesystem string using stack-based depth tracking efficiently.

中等
390

消除游戏

Elimination Game uses a systematic removal of numbers with alternating left-right passes, solvable with math and recursi…

中等
393

UTF-8 编码验证

Determine if an integer array represents valid UTF-8 encoding based on its byte sequences using bit manipulation.

中等
394

字符串解码

Decode a nested encoded string using stack-based state management, handling repeated patterns efficiently with recursion…

中等
395

至少有 K 个重复字符的最长子串

Find the length of the longest substring where every character appears at least k times using sliding window and divide-…

中等
396

旋转函数

Maximize the rotation function by rotating the array and calculating the weighted sum for all rotations.

中等
397

整数替换

Find the minimum number of operations to reduce a number to 1 by applying specific operations, using state transition dy…

中等
398

随机数索引

Random Pick Index involves selecting a random index of a target number in an array with possible duplicates.

中等
399

除法求值

Compute the results of division queries from given equations using graph traversal and depth-first search efficiently.

中等
400

第 N 位数字

Given n, efficiently find the nth digit in the infinite integer sequence using a binary search over valid positions.

中等
402

移掉 K 位数字

Remove K Digits requires selecting which digits to drop using a monotonic stack for the smallest possible integer result…

中等
406

根据身高重建队列

Reconstruct a queue based on the given heights and the number of taller people in front, using sorting and binary indexe…

中等
413

等差数列划分

Count the number of arithmetic subarrays in a given integer array using dynamic programming.

中等
416

分割等和子集

Determine if an array can be partitioned into two subsets with equal sum using dynamic programming techniques.

中等
417

太平洋大西洋水流问题

Find all cells on an island where water can flow to both the Pacific and Atlantic oceans using DFS or BFS.

中等
419

棋盘上的战舰

Count the number of non-overlapping battleships on a 2D board using array traversal and depth-first search patterns effi…

中等
421

数组中两个数的最大异或值

Find the maximum XOR of two numbers in an integer array using efficient bit manipulation techniques.

中等
423

从英文中重建数字

This problem asks you to reconstruct digits from an out-of-order English string using hash counting and mathematical ded…

中等
424

替换后的最长重复字符

Find the length of the longest substring after at most k replacements using a sliding window and character count trackin…

中等
427

建立四叉树

Construct a Quad-Tree from a binary matrix by recursively subdividing regions and tracking uniform states efficiently.

中等
429

N 叉树的层序遍历

Perform a level order traversal on an n-ary tree, capturing nodes by depth using breadth-first search with careful state…

中等
430

扁平化多级双向链表

Flatten a multilevel doubly linked list by correctly updating next, prev, and child pointers to create a single-level se…

中等
433

最小基因变化

Determine the minimum number of single-character gene mutations to reach the target gene using BFS and a hash table look…

中等
435

无重叠区间

Determine the minimum number of intervals to remove from a list to ensure no intervals overlap using dynamic programming…

中等
437

路径总和 III

Path Sum III challenges you to count paths in a binary tree that sum to a given target value with downward traversal.

中等
438

找到字符串中所有字母异位词

Find all starting indices of p's anagrams in s using sliding window and hash table approach.

中等
442

数组中重复的数据

Find all integers that appear twice in an array with O(n) time and constant space complexity.

中等
443

压缩字符串

Compress a character array in-place by converting consecutive repeated characters into counts using two-pointer scanning…

中等
445

两数相加 II

Add Two Numbers II involves summing two numbers represented as linked lists and returning the result as a new linked lis…

中等
447

回旋镖的数量

Compute all valid boomerang tuples in a point set using array scanning with hash maps to track distances efficiently.

中等
449

序列化和反序列化二叉搜索树

Design an algorithm to serialize and deserialize a binary search tree with efficient traversal and state tracking.

中等
450

删除二叉搜索树中的节点

Delete Node in a BST hinges on removing one target while preserving in-order ordering through carefully chosen subtree r…

中等
451

根据字符出现频率排序

Sort Characters By Frequency requires counting characters efficiently and rearranging a string in descending frequency o…

中等
452

用最少数量的箭引爆气球

Find the minimum number of arrows needed to burst all balloons by considering greedy choice and invariant validation.

中等
453

最小操作次数使数组元素相等

Compute the fewest steps to make all elements equal by incrementing n-1 array items, applying array and math reasoning.

中等
454

四数相加 II

Count all quadruples from four integer arrays that sum to zero using efficient array scanning and hash table lookups.

中等
456

132 模式

Identify whether a given integer array contains a 132 pattern subsequence using efficient stack and search techniques.

中等
457

环形数组是否存在循环

Detect whether a circular array contains a loop of consistent direction using efficient array scanning and hash lookup t…

中等
462

最小操作次数使数组元素相等 II

Find the minimum moves to equalize all array elements using increments or decrements with array and math techniques.

中等
464

我能赢吗

Determine if the first player can guarantee a win in a turn-based number selection game using state transition dynamic p…

中等
467

环绕字符串中唯一的子字符串

Solve the 'Unique Substrings in Wraparound String' problem using dynamic programming with a state transition approach.

中等
468

验证IP地址

Determine whether a given string is a valid IPv4 or IPv6 address using a precise string-driven validation strategy.

中等
470

用 Rand7() 实现 Rand10()

Generate uniform random numbers from 1 to 10 using only rand7(), applying rejection sampling for consistent probability …

中等
473

火柴拼正方形

The problem asks to determine if we can use matchsticks to form a square, exploring dynamic programming and backtracking…

中等
474

一和零

Solve the Ones and Zeroes problem using dynamic programming with state transition, focusing on array and string manipula…

中等
475

供暖器

Determine the minimum heater radius to cover all houses using a binary search over potential radius values efficiently.

中等
477

汉明距离总和

Calculate the total Hamming distance between all pairs in an integer array using efficient bit manipulation techniques.

中等
478

在圆内随机生成点

Generate Random Point in a Circle requires creating a uniform random point inside a circle using math and geometry princ…

中等
481

神奇字符串

Count the number of '1's in the first n characters of a magical string using two-pointer scanning and invariant tracking…

中等
486

预测赢家

Predict the Winner involves two players taking turns to maximize their score by picking from either end of an array, opt…

中等
491

非递减子序列

Return all possible non-decreasing subsequences with at least two elements from the input array, nums.

中等
494

目标和

Target Sum requires counting all expressions from nums using '+' or '-' that evaluate exactly to the given target intege…

中等
497

非重叠矩形中的随机点

Design an algorithm to pick random points within non-overlapping rectangles using binary search and reservoir sampling.

中等
498

对角线遍历

Traverse a matrix diagonally and return all elements in the specific zig-zag order required by the problem pattern.

中等
503

下一个更大元素 II

Solve the Next Greater Element II problem by using a stack-based state management approach for circular arrays.

中等
508

出现次数最多的子树元素和

Identify the most frequent subtree sum in a binary tree using DFS and hash table tracking for efficient state management…

中等
513

找树左下角的值

Find the leftmost value in the last row of a binary tree using efficient traversal strategies.

中等
515

在每个树行中找最大值

Find the largest value in each row of a binary tree using depth-first or breadth-first search techniques.

中等
516

最长回文子序列

Find the length of the longest palindromic subsequence in a string using precise state transition dynamic programming.

中等
518

零钱兑换 II

Calculate the number of unique coin combinations to reach a target amount using state transition dynamic programming eff…

中等
519

随机翻转矩阵

Design an optimized algorithm to randomly flip an index in a matrix, using hash tables and math for efficient random sel…

中等
522

最长特殊序列 II

Find the longest string in an array that is not a subsequence of any other string, using array scanning and hash checks …

中等
523

连续的子数组和

Identify if any continuous subarray sums to a multiple of k using prefix sums and hash table tracking efficiently.

中等
524

通过删除字母匹配到字典里最长单词

Find the longest word in the dictionary that can be formed by deleting characters from a string, using two-pointer scann…

中等
525

连续数组

Find the maximum length contiguous subarray with equal numbers of 0s and 1s using array scanning and hash lookup efficie…

中等
526

优美的排列

The Beautiful Arrangement problem asks for the number of valid permutations of n integers satisfying specific divisibili…

中等
528

按权重随机选择

Random Pick with Weight requires implementing a probabilistic index picker using prefix sums and binary search efficient…

中等
529

扫雷游戏

Solve the Minesweeper game by updating revealed squares and handling clicks with Depth-First Search and Array manipulati…

中等
532

数组中的 k-diff 数对

Solve K-diff Pairs in an Array by counting unique differences with a hash map or sorted two-pointer sweep.

中等
535

TinyURL 的加密与解密

Design a class that encodes and decodes URLs using a URL shortening approach based on hash tables and strings.

中等
537

复数乘法

This problem requires multiplying two complex numbers, given in string form, and returning the result in the same format…

中等
538

把二叉搜索树转换为累加树

Convert a BST into a Greater Tree by updating each node’s value with the sum of all greater values in the tree.

中等
539

最小时间差

Calculate the smallest time difference between clock points using array manipulation and mathematical conversions effici…

中等
540

有序数组中的单一元素

Find the single non-duplicate element in a sorted array where every other element appears exactly twice.

中等
542

01 矩阵

The '01 Matrix' problem challenges you to find the nearest zero for each cell in a binary matrix using dynamic programmi…

中等
547

省份数量

Solve Number of Provinces by scanning the adjacency matrix and launching DFS once per unvisited city component.

中等
553

最优除法

Maximize the value of an expression by optimally placing parentheses for division operations.

中等
554

砖墙

Solve the Brick Wall problem using array scanning and hash lookups to minimize crossed bricks from a vertical line.

中等
556

下一个更大元素 III

Find the next greater integer using the same digits as a given number with precise two-pointer scanning and invariant tr…

中等
558

四叉树交集

Compute the logical OR of two binary matrices represented as Quad-Trees using recursive tree traversal and state propaga…

中等
560

和为 K 的子数组

Count the total number of contiguous subarrays in an integer array that sum exactly to a target value k using optimized …

中等
565

数组嵌套

Find the longest nested set in a permutation array using a depth-first traversal, handling cycles efficiently for medium…

中等
567

字符串的排列

Check if a string contains a permutation of another string using two-pointer scanning and hash table techniques.

中等
576

出界的路径数

Calculate the number of ways a ball can exit a grid using dynamic programming with state transitions for every move comb…

中等
581

最短无序连续子数组

Find the shortest unsorted continuous subarray that, if sorted, would sort the entire array.

中等
583

两个字符串的删除操作

Find the minimum number of steps to make two strings equal by deleting characters, using dynamic programming.

中等
592

分数加减运算

Solve fraction addition and subtraction by handling expressions, calculating results, and simplifying fractions to irred…

中等
593

有效的正方形

Determine if four given 2D points form a valid square using geometric distance checks and vector validation techniques.

中等
606

根据二叉树创建字符串

Given a binary tree, construct a string representation based on preorder traversal while adhering to specific formatting…

中等
609

在系统中查找重复文件

Find and return duplicate files in the file system, grouping them by their paths and contents using an array scanning ap…

中等
611

有效三角形的个数

Count all triplets in an integer array that satisfy the triangle inequality to form valid triangles efficiently using so…

中等
621

任务调度器

Task Scheduler is solved by counting task frequencies and computing how cooldown gaps force idle slots around the most f…

中等
622

设计循环队列

Design a circular queue that allows efficient FIFO operations using linked-list pointer manipulation to optimize space u…

中等
623

在二叉树中增加一行

The problem requires adding a row of nodes to a binary tree at a specified depth.

中等
624

数组列表中的最大距离

Maximum Distance in Arrays uses a greedy running minimum and maximum from previous arrays to validate cross array distan…

中等
633

平方数之和

Given a non-negative integer c, determine if there are two integers whose squares sum to c.

中等
636

函数的独占时间

Solve the 'Exclusive Time of Functions' problem using stack-based state management for accurate function execution time …

中等
638

大礼包

Minimize the cost of purchasing items using available special offers with state transition dynamic programming.

中等
640

求解方程

Solve the equation for the variable 'x' and determine its value or state if there is no solution or infinite solutions.

中等
641

设计循环双端队列

Design and implement a circular deque using linked-list pointer manipulation, ensuring efficient insertion and deletion …

中等
646

最长数对链

Determine the maximum length of a chain formed by pairs using dynamic programming and greedy sorting techniques efficien…

中等
647

回文子串

Count all palindromic substrings in a given string using state transition dynamic programming for efficient evaluation.

中等
648

单词替换

Replace words in a sentence using the shortest root from a dictionary, applying efficient array scanning and hash lookup…

中等
649

Dota2 参议院

The Dota2 Senate problem involves simulating voting rounds between Radiant and Dire senators until one party wins, using…

中等
650

两个键的键盘

Minimize the number of operations to get exactly 'n' characters on the screen using two operations: Copy All and Paste.

中等
652

寻找重复的子树

Identify all duplicate subtrees in a binary tree by efficiently tracking structure and values with depth-first traversal…

中等
654

最大二叉树

Construct a maximum binary tree by recursively selecting the largest element and dividing the array into left and right …

中等
655

输出二叉树

Print Binary Tree requires arranging a binary tree into a visually structured matrix using precise traversal and positio…

中等
658

找到 K 个最接近的元素

Identify the k integers closest to a target x in a sorted array using binary search and two-pointer strategies efficient…

中等
659

分割数组为连续子序列

Verify if it's possible to split a sorted array into consecutive subsequences of length 3 or more.

中等
662

二叉树最大宽度

Determine the maximum width of a binary tree by calculating the width of each level and considering the positions of the…

中等
665

非递减数列

Check if an array can become non-decreasing by modifying at most one element using an array-driven solution strategy.

中等
667

优美的排列 II

Construct a beautiful arrangement of integers from 1 to n with k distinct integers, optimizing for time and space effici…

中等
669

修剪二叉搜索树

Trim a Binary Search Tree by maintaining its structure while removing nodes outside a given range.

中等
670

最大交换

Given an integer, swap at most two digits once to produce the largest possible number using greedy digit selection.

中等
672

灯泡开关 Ⅱ

Compute all unique bulb configurations after a fixed number of presses using math and bit manipulation efficiently.

中等
673

最长递增子序列的个数

This problem challenges you to find the number of longest increasing subsequences in a given array of integers.

中等
676

实现一个魔法字典

Design a Magic Dictionary to allow searching with one-character modifications, using Hash Table and String techniques.

中等
677

键值映射

Design and implement a data structure that supports efficient insertion and sum queries based on string prefixes.

中等
678

有效的括号字符串

Solve the Valid Parenthesis String problem by leveraging state transition dynamic programming to handle parentheses and …

中等
684

冗余连接

Identify and remove the redundant edge that causes a cycle in a graph starting as a tree.

中等
686

重复叠加字符串匹配

Find the minimum number of repetitions of string a to make string b a substring of the repeated string a.

中等
687

最长同值路径

Find the longest path in a binary tree where all nodes share the same value using depth-first search efficiently.

中等
688

骑士在棋盘上的概率

Calculate the probability that a knight remains on an n x n chessboard after making exactly k moves using dynamic progra…

中等
690

员工的重要性

Calculate an employee's total importance including all direct and indirect subordinates using array scanning and hash lo…

中等
692

前K个高频单词

Solve Top K Frequent Words by counting each word, then ordering ties alphabetically so frequency wins before lexicograph…

中等
695

岛屿的最大面积

Find the largest connected land area in a binary grid using array traversal and depth-first search efficiently.

中等
698

划分为k个相等的子集

Determine if an integer array can be partitioned into k subsets where each subset sums to the same value using DP and ba…

中等
701

二叉搜索树中的插入操作

Insert a value into a Binary Search Tree while maintaining the BST properties, focusing on tree traversal and state trac…

中等
707

设计链表

Implement a custom linked list supporting head, tail, index insertions, retrieval, and deletions efficiently with pointe…

中等
712

两个字符串的最小ASCII删除和

This problem focuses on minimizing the ASCII delete sum for two strings by using dynamic programming to find the lowest …

中等
713

乘积小于 K 的子数组

Count subarrays with a product strictly less than a given value k using efficient algorithms like binary search and slid…

中等
714

买卖股票的最佳时机含手续费

Maximize stock trading profits accounting for per-transaction fees using state transition dynamic programming and greedy…

中等
718

最长重复子数组

Find the maximum length of a subarray that appears in both given integer arrays using dynamic programming.

中等
720

词典中最长的单词

Find the longest word in a dictionary that can be built one character at a time from other words in the dictionary.

中等
721

账户合并

Merge accounts by connecting emails and returning each user's sorted email list using array scanning and hash lookup eff…

中等
722

删除注释

Remove comments from a given C++ program source array, handling line and block comments.

中等
725

分隔链表

Efficiently split a singly linked list into k consecutive parts, balancing sizes while preserving the original node orde…

中等
729

我的日程安排表 I

Implement a calendar supporting non-overlapping event bookings using binary search for efficient insertion and conflict …

中等
731

我的日程安排表 II

Implement a calendar that allows double bookings but prevents triple bookings, managing overlapping intervals efficientl…

中等
735

小行星碰撞

Determine the final positions of moving asteroids using a stack-based simulation for efficient collision resolution in l…

中等
738

单调递增的数字

Determine the largest number less than or equal to n with digits in non-decreasing order using a greedy, invariant-drive…

中等
739

每日温度

In the Daily Temperatures problem, you need to find out how many days to wait for a warmer temperature based on given da…

中等
740

删除并获得点数

Maximize points by deleting numbers from an array while removing all adjacent values, using dynamic programming efficien…

中等
743

网络延迟时间

Find the minimum time for a signal to travel to all nodes in a directed graph or determine if it's impossible.

中等
752

打开转盘锁

Solve the Open the Lock problem using array scanning plus hash lookup to efficiently find the shortest unlock sequence.

中等
754

到达终点数字

Determine the minimum number of moves to reach a target on an infinite number line using step increments, leveraging bin…

中等
756

金字塔转换矩阵

The Pyramid Transition Matrix problem requires determining whether a pyramid can be formed with given blocks and valid p…

中等
763

划分字母区间

Partition a string into maximal parts so that each letter appears in only one segment, using two-pointer scanning.

中等
764

最大加号标志

Find the largest axis-aligned plus sign in a binary grid with some mines using dynamic programming.

中等
767

重构字符串

Reorganize a string so that no two adjacent characters are the same, if possible, using a greedy approach.

中等
769

最多能完成排序的块

The Max Chunks To Make Sorted problem requires you to split an array into the maximum number of chunks that can be sorte…

中等
775

全局倒置与局部倒置

Determine if every global inversion in a permutation array is also a local inversion using array and math logic efficien…

中等
777

在 LR 字符串中交换相邻字符

Transform one string into another by swapping adjacent 'L' and 'R' characters in a sequence of moves.

中等
779

第K个语法符号

Determine the K-th symbol in a recursively generated grammar table using math and bit manipulation patterns efficiently.

中等
781

森林中的兔子

Solve Rabbits in Forest by grouping equal answers and rounding each group into the smallest valid color-class size.

中等
784

字母大小写全排列

Letter Case Permutation involves generating all possible strings by changing the case of each letter in a given string.

中等
785

判断二分图

Determine whether an undirected graph can be split into two independent sets using DFS, BFS, or Union Find patterns.

中等
786

第 K 个最小的质数分数

Find the k-th smallest fraction from a sorted array of unique primes using a binary search over the answer space.

中等
787

K 站中转内最便宜的航班

Find the cheapest flight from a source to a destination with at most K stops using graph traversal techniques efficientl…

中等
788

旋转数字

Count all integers from 1 to n that transform into a different valid number when each digit is rotated 180 degrees using…

中等
789

逃脱阻碍者

Escape The Ghosts tests your ability to analyze movements in an infinite grid while racing against ghost positions using…

中等
790

多米诺和托米诺平铺

Calculate the number of ways to tile a 2xN board using dominoes and trominoes with precise state transitions.

中等
791

自定义字符串排序

Sort the string `s` according to a custom order defined by string `order`.

中等
792

匹配子序列的单词数

Given a string s and a list of words, count how many words are subsequences of s using efficient array scanning and hash…

中等
794

有效的井字游戏

Verify if a given Tic-Tac-Toe board can represent a valid game state during a valid sequence of moves.

中等
795

区间子数组个数

Count the number of contiguous subarrays with a bounded maximum value using a two-pointer approach.

中等
797

所有可能的路径

Find all paths in a directed acyclic graph (DAG) from source to target using depth-first search and backtracking.

中等
799

香槟塔

Compute champagne levels in a pyramid of glasses using state transition dynamic programming for accurate distribution tr…

中等
802

找到最终的安全状态

Solve the problem of finding eventual safe states in a directed graph using depth-first search and topological sorting.

中等
807

保持城市天际线

Maximize building heights in a city grid without changing the skyline, using greedy selection constrained by row and col…

中等
808

分汤

Compute the probability that soup A empties before soup B using state transition dynamic programming efficiently.

中等
809

情感丰富的文字

Expressive Words challenges you to determine if a word can be transformed into a given string by extending groups of rep…

中等
811

子域名访问计数

The Subdomain Visit Count problem requires counting the visits to all subdomains of a given domain from a list of count-…

中等
813

最大平均值和的分组

Maximize the sum of averages by partitioning an integer array into at most k contiguous subarrays using dynamic programm…

中等
814

二叉树剪枝

Binary Tree Pruning removes subtrees not containing a 1, applying binary-tree traversal with state tracking.

中等
816

模糊坐标

Find all valid 2D coordinate possibilities for an ambiguous input string using backtracking and pruning techniques.

中等
817

链表组件

Count the number of connected components in a linked list subset using array scanning and hash table lookups efficiently…

中等
820

单词的压缩编码

Find the minimum length of a reference string encoding an array of words using array scanning and hash lookup efficientl…

中等
822

翻转卡片游戏

The Card Flipping Game problem asks for the smallest integer that can be facing down but not up after flipping cards.

中等
823

带因子的二叉树

Given an array of integers, find how many binary trees can be formed such that non-leaf nodes' values are the product of…

中等
825

适龄的朋友

The Friends Of Appropriate Ages problem involves counting valid friend requests between people based on their ages with …

中等
826

安排工作以达到最大收益

Assign workers to jobs maximizing total profit using difficulty, profit, and worker arrays efficiently with binary searc…

中等
831

隐藏个人信息

This problem requires masking sensitive parts of emails and phone numbers using a precise string-driven strategy efficie…

中等
833

字符串中的查找与替换

This problem challenges you to perform multiple string replacements at specific indices using a pattern involving array …

中等
835

图像重叠

Image Overlap requires calculating the overlap between two binary matrices by translating one image over the other.

中等
837

新 21 点

Calculate the probability Alice reaches at most n points using state transition dynamic programming efficiently.

中等
838

推多米诺

In the "Push Dominoes" problem, you simulate the falling dominoes based on their initial states and determine their fina…

中等
840

矩阵中的幻方

Scan every 3x3 window, reject invalid digits fast, then verify row, column, and diagonal sums for Magic Squares In Grid.

中等
841

钥匙和房间

Determine if all rooms can be visited given keys distributed across a set of interconnected locked rooms using graph tra…

中等
842

将数组拆分成斐波那契序列

This problem challenges you to split a string into a Fibonacci-like sequence using backtracking and pruning.

中等
845

数组中的最长山脉

Find the length of the longest subarray forming a mountain pattern using state transitions and two-pointer logic efficie…

中等
846

一手顺子

Check if a hand of cards can be rearranged into groups of consecutive values.

中等
848

字母移位

Given a string and a shift array, shift the first i+1 letters of the string as specified in the array.

中等
849

到最近的人的最大距离

Determine the seat placement that maximizes distance to the nearest person using a linear array scan strategy efficientl…

中等
851

喧闹和富有

Determine the quietest person richer than each individual using graph indegree analysis and topological ordering techniq…

中等
852

山脉数组的峰顶索引

Find the peak index in a mountain array using binary search for efficient O(log n) time complexity.

中等
853

车队

The Car Fleet problem asks how many car fleets will reach a target given their starting positions and speeds, considerin…

中等
855

考场就座

Simulate an exam room where each student chooses a seat maximizing distance to others, using design plus heap structures…

中等
856

括号的分数

Calculate the score of a balanced parentheses string using stack-based state management for an optimal solution.

中等
858

镜面反射

Given a square room with mirrors, find which receptor a laser ray will hit first based on two integers, p and q.

中等
861

翻转矩阵后的得分

Maximize the score of a binary matrix by flipping rows and columns using a greedy approach and validation of invariants.

中等
863

二叉树中所有距离为 K 的结点

Find all nodes at distance K from a target node in a binary tree using various tree traversal techniques.

中等
865

具有所有最深节点的最小子树

Find the smallest subtree that contains all the deepest nodes in a binary tree.

中等
866

回文质数

The Prime Palindrome problem asks for the smallest prime palindrome greater than or equal to a given integer.

中等
869

重新排序得到 2 的幂

Determine if a number's digits can be rearranged to form a power of two using counting and hash-based checks.

中等
870

优势洗牌

Maximize the advantage of nums1 over nums2 using a two-pointer greedy strategy, carefully tracking which elements beat o…

中等
873

最长的斐波那契子序列的长度

Find the length of the longest Fibonacci-like subsequence from a strictly increasing array of integers.

中等
874

模拟行走机器人

The Walking Robot Simulation problem involves moving a robot in an infinite grid and calculating its furthest distance f…

中等
875

爱吃香蕉的珂珂

Koko Eating Bananas challenges you to find the minimum eating speed to finish piles of bananas in a given time using bin…

中等
877

石子游戏

Stone Game is a dynamic programming problem where players alternate taking stones from piles to maximize their score.

中等
880

索引处的解码字符串

Decode the string and find the k-th letter efficiently using stack-based state management in this problem.

中等
881

救生艇

Find the minimum number of boats required to save all people, using a two-pointer approach for efficient pairing.

中等
885

螺旋矩阵 III

Solve the Spiral Matrix III problem by simulating the movement across a matrix with specific constraints on direction an…

中等
886

可能的二分法

Determine if a group of n people with mutual dislikes can be split into two non-conflicting groups using graph traversal…

中等
889

根据前序和后序遍历构造二叉树

Reconstruct a binary tree from preorder and postorder traversals using array scanning and hash lookup.

中等
890

查找和替换模式

Identify all words matching a given pattern by checking consistent letter mappings using hash tables and array scanning …

中等
893

特殊等价字符串组

Determine the number of special-equivalent string groups using character swaps at even or odd indices efficiently.

中等
894

所有可能的真二叉树

Generate all possible full binary trees with n nodes, focusing on dynamic programming and binary tree traversal.

中等
898

子数组按位或操作

Compute the number of unique bitwise OR values from all non-empty subarrays using dynamic state transitions efficiently.

中等
900

RLE 迭代器

Design an efficient iterator for a run-length encoded array, handling large counts and sequential access correctly every…

中等
901

股票价格跨度

Design an efficient algorithm using stacks to calculate the stock span for daily price quotes.

中等
904

水果成篮

The Fruit Into Baskets problem requires finding the maximum number of fruits you can pick from a row of trees under spec…

中等
907

子数组的最小值之和

Calculate the sum of minimum values across all subarrays of a given array modulo 10^9 + 7.

中等
909

蛇梯棋

Solve the Snakes and Ladders problem using a BFS strategy to efficiently navigate the board and reach the final square.

中等
910

最小差值 II

Determine the minimum possible difference between the largest and smallest numbers after adjusting each by plus or minus…

中等
911

在线选举

Solve the Online Election problem by implementing a class that tracks votes and queries the leading candidate at any giv…

中等
912

排序数组

Sort an array using an optimal algorithm, focusing on time and space complexity considerations.

中等
915

分割数组

Partition the array into two subarrays such that the left contains the smallest possible elements and the right contains…

中等
916

单词子集

Word Subsets is solved by merging words2 into one max-frequency requirement, then scanning words1 against that fixed let…

中等
918

环形子数组的最大和

Find the maximum sum of a circular subarray using state transition dynamic programming, optimizing for wraparound cases …

中等
919

完全二叉树插入器

Implement a data structure to insert nodes into a complete binary tree while preserving its completeness efficiently.

中等
921

使括号有效的最少添加

Compute the minimum insertions needed to make a parentheses string valid using efficient stack-based state tracking tech…

中等
923

三数之和的多种可能

Count all unique triplets in an integer array whose sum equals the target, handling multiplicity efficiently using hashi…

中等
926

将字符串翻转到单调递增

Minimize the number of flips needed to make a binary string monotone increasing using dynamic programming.

中等
930

和相同的二元子数组

Count all contiguous subarrays in a binary array whose elements sum exactly to a given goal using prefix sums efficientl…

中等
931

下降路径最小和

Minimum Falling Path Sum is a matrix dynamic programming problem where each cell depends on three reachable cells above …

中等
932

漂亮数组

Beautiful Array builds a valid permutation by recursively separating odd and even positions so no middle-average triple …

中等
934

最短的桥

Find the minimum flips to connect two separate islands in a binary matrix using Array and DFS techniques efficiently.

中等
935

骑士拨号器

Solve the Knight Dialer problem using state transition dynamic programming to efficiently calculate valid number paths f…

中等
937

重新排列日志文件

Reorder Data in Log Files requires sorting letter-logs lexicographically while keeping digit-logs in original order for …

中等
939

最小面积矩形

Find the minimum area of a rectangle formed by given points on a 2D plane with sides parallel to axes.

中等
945

使数组唯一的最小增量

This problem challenges you to find the minimum moves to make all elements in an array unique by incrementing elements.

中等
946

验证栈序列

Determine if a sequence of push and pop operations can produce the given popped array using a stack-based state approach…

中等
947

移除最多的同行或同列石头

Maximize the number of stones removed from a 2D plane using graph traversal and DFS.

中等
948

令牌放置

Maximize your score in the Bag of Tokens problem by strategically playing tokens with two-pointer scanning and greedy te…

中等
949

给定数字能组成的最大时间

Given four digits, determine the latest valid 24-hour time possible using each digit exactly once with backtracking.

中等
950

按递增顺序显示卡牌

Determine the initial deck order to reveal cards in strictly increasing order using queue-driven simulation logic.

中等
951

翻转等价二叉树

Determine if two binary trees are flip equivalent by recursively swapping subtrees.

中等
954

二倍数对数组

Given an array of even length, check if it can be reordered to satisfy a specific doubling condition.

中等
955

删列造序 II

Solve the "Delete Columns to Make Sorted II" problem by applying greedy choices and invariant validation to string array…

中等
957

N 天后的牢房

Determine the state of 8 prison cells after N days using array scanning and cycle detection for repeated patterns effici…

中等
958

二叉树的完全性检验

Determine if a binary tree is complete by verifying its node structure and leftmost placement in the last level.

中等
959

由斜杠划分区域

Determine the number of regions in a grid divided by slashes using array scanning and union-find techniques efficiently.

中等
962

最大宽度坡

Find the maximum width of a ramp where nums[i] <= nums[j] for i < j using a two-pointer approach.

中等
963

最小面积矩形 II

Find the minimum area rectangle from given points in the X-Y plane, with sides not necessarily parallel to the axes.

中等
966

元音拼写检查器

Implement a spellchecker that matches queries to a wordlist using exact, case-insensitive, and vowel-error rules efficie…

中等
967

连续差相同的数字

Generate all n-digit numbers where consecutive digits differ by k using efficient backtracking and BFS techniques.

中等
969

煎饼排序

Sort an array using pancake flips, leveraging two-pointer scanning and invariant tracking to iteratively position the la…

中等
970

强整数

Find all integers that can be expressed as x^i + y^j up to a given bound using a Hash Table plus Math approach.

中等
971

翻转二叉树以匹配先序遍历

Determine the minimum set of nodes to flip in a binary tree so its pre-order traversal matches a given voyage sequence.

中等
973

最接近原点的 K 个点

Find the k closest points to the origin in a 2D plane using array operations and Euclidean distance calculations efficie…

中等
974

和可被 K 整除的子数组

Count the number of subarrays whose sum is divisible by a given integer k using array scanning and hash lookup.

中等
978

最长湍流子数组

Find the length of the longest subarray where element comparisons alternate, using state transition dynamic programming …

中等
979

在二叉树中分配硬币

Minimize the number of moves needed to distribute coins in a binary tree so that each node has exactly one coin.

中等
981

基于时间的键值存储

Implement a time-based key-value store that retrieves the latest value at a given timestamp using efficient binary searc…

中等
983

最低票价

Solve the Minimum Cost For Tickets problem using state transition dynamic programming for optimal travel ticket purchase…

中等
984

不含 AAA 或 BBB 的字符串

Solve the problem of constructing a string without consecutive 'AAA' or 'BBB' by applying a greedy approach with invaria…

中等
985

查询后的偶数和

Efficiently update an integer array based on queries and compute the sum of even numbers after each modification using s…

中等
986

区间列表的交集

This problem requires finding the intersection of two lists of intervals using a two-pointer technique with invariant tr…

中等
988

从叶结点开始的最小字符串

Determine the lexicographically smallest string from a leaf to root using binary-tree traversal and careful state tracki…

中等
990

等式方程的可满足性

Determine if it's possible to assign values to variables such that all equations are satisfied based on equality and ine…

中等
991

坏了的计算器

Compute the minimum operations to transform startValue into target using doubling and decrementing, leveraging a greedy …

中等
994

腐烂的橘子

Given a grid with fresh and rotten oranges, return the minimum time for all oranges to rot or -1 if impossible.

中等
998

最大二叉树 II

The Maximum Binary Tree II problem requires building a binary tree by inserting a value into a maximum binary tree while…

中等
1003

检查替换后的词是否有效

Determine if a string can be built from repeated 'abc' insertions using stack-based state management, verifying sequence…

中等
1004

最大连续1的个数 III

Find the longest consecutive ones in a binary array by optimally flipping at most k zeros using sliding window technique…

中等
1006

笨阶乘

Compute the clumsy factorial of a number using a fixed rotation of multiply, divide, add, and subtract operations effici…

中等
1007

行相等的最少多米诺旋转

Minimize domino rotations to make either row identical in the problem of Minimum Domino Rotations For Equal Row.

中等
1008

前序遍历构造二叉搜索树

Construct a binary search tree directly from a preorder traversal array using stack-based state tracking efficiently.

中等
1010

总持续时间可被 60 整除的歌曲

Calculate the number of song pairs whose total durations sum to a multiple of 60 using array scanning and hash lookups.

中等
1011

在 D 天内送达包裹的能力

Find the minimum ship capacity needed to ship all packages within D days, ensuring the cargo is shipped in the given ord…

中等
1014

最佳观光组合

Compute the maximum sightseeing score efficiently using state transition dynamic programming and single-pass array itera…

中等
1015

可被 K 整除的最小整数

Find the length of the smallest positive integer divisible by k that consists only of the digit '1'.

中等
1016

子串能表示从 1 到 N 数字的二进制串

Check if binary string contains all integers from 1 to n as substrings, leveraging sliding window and bit manipulation t…

中等
1017

负二进制转换

Convert any non-negative integer into its base -2 representation using a math-driven iterative remainder strategy.

中等
1019

链表中的下一个更大节点

Find the next greater value for each node in a linked list using monotonic stack techniques for efficient traversal.

中等
1020

飞地的数量

This problem involves finding the number of land cells that cannot reach the boundary in a grid using DFS and array mani…

中等
1023

驼峰式匹配

Camelcase Matching is a medium difficulty problem where you match queries to a given pattern by inserting lowercase lett…

中等
1024

视频拼接

Solve the "Video Stitching" problem using state transition dynamic programming to cover a sporting event with minimum cl…

中等
1026

节点与其祖先之间的最大差值

Find the maximum absolute difference between a node and its ancestor in a binary tree.

中等
1027

最长等差数列

Find the length of the longest arithmetic subsequence in a given integer array using scanning and hash-based lookup.

中等
1029

两地调度

Two City Scheduling requires selecting optimal city assignments for 2n people to minimize total travel costs efficiently…

中等
1031

两个无重叠子数组的最大和

Find the maximum sum of two non-overlapping subarrays by efficiently using state transition dynamic programming.

中等
1033

移动石子直到连续

Solve the "Moving Stones Until Consecutive" problem using math and brainteaser patterns by determining the minimum and m…

中等
1034

边界着色

Given a grid and a starting cell, color all border cells of the connected component using DFS while preserving interior …

中等
1035

不相交的线

The Uncrossed Lines problem involves finding the maximum number of non-intersecting lines that can be drawn between two …

中等
1038

从二叉搜索树到更大和树

Convert a Binary Search Tree to a Greater Sum Tree by accumulating all larger node values using reverse in-order travers…

中等
1039

多边形三角剖分的最低得分

Compute the minimum total score to triangulate a convex polygon using state transition dynamic programming on vertex val…

中等
1040

移动石子直到连续 II

Determine the minimum and maximum moves to make stones consecutive using sliding window and endpoint adjustments efficie…

中等
1041

困于环中的机器人

Determine if a robot following a repeated instruction sequence stays within a bounded circle using math and string simul…

中等
1042

不邻接植花

In this problem, you are tasked with planting flowers in gardens with specific constraints based on graph traversal prin…

中等
1043

分隔数组以得到最大和

Partition an array into subarrays of length at most k, replacing each with its maximum to maximize total sum efficiently…

中等
1048

最长字符串链

Find the longest word chain by scanning arrays and using hash lookups to efficiently track predecessor-successor sequenc…

中等
1049

最后一块石头的重量 II

In the 'Last Stone Weight II' problem, you need to find the minimal possible stone weight after a series of smashes usin…

中等
1052

爱生气的书店老板

Maximize satisfied customers in a bookstore by strategically suppressing the owner's grumpy minutes using a sliding wind…

中等
1053

交换一次的先前排列

Find the lexicographically largest permutation smaller than the given array using exactly one swap, leveraging a greedy …

中等
1054

距离相等的条形码

Rearrange barcodes in an array so that no two adjacent elements are equal, using a greedy approach and hash table for ef…

中等
1061

按字典序排列最小的等效字符串

Determine the lexicographically smallest string by modeling character equivalences with union find efficiently.

中等
1072

按列翻转得到最大值等行数

Maximize the number of equal rows in a binary matrix by flipping any number of columns.

中等
1073

负二进制数相加

Add two numbers represented in negabinary format and return the result in the same format.

中等
1079

活字印刷

Compute all unique non-empty sequences from given letter tiles using backtracking search with pruning efficiently.

中等
1080

根到叶路径上的不足节点

Remove nodes in a binary tree whose all root-to-leaf paths sum to less than a given limit using DFS traversal and state …

中等
1081

不同字符的最小子序列

The Smallest Subsequence of Distinct Characters problem asks you to find the lexicographically smallest subsequence of a…

中等
1090

受标签影响的最大值

Maximize the sum of selected item values while respecting label use limits using array scanning and hash tracking.

中等
1091

二进制矩阵中的最短路径

Find the shortest clear path in a binary matrix using BFS, carefully handling obstacles and diagonal movements for effic…

中等
1093

大样本统计

Calculate minimum, maximum, mean, median, and mode from a large sample represented by an array of counts.

中等
1094

拼车

Determine if a car can handle multiple trips without exceeding its capacity using array sorting and event simulation tec…

中等
1104

二叉树寻路

The problem involves finding the path from the root to a node in a zigzag-labelled binary tree.

中等
1105

填充书架

Determine the minimum total height of a bookcase by placing books in order using state transition dynamic programming.

中等
1109

航班预订统计

Solve Corporate Flight Bookings by marking range changes once, then building final seat totals with a single prefix sum …

中等
1110

删点成林

Delete nodes from a binary tree using array scanning and hash lookup to return the remaining forest efficiently.

中等
1111

有效括号的嵌套深度

This problem challenges you to compute the maximum nesting depth of two valid parentheses strings using stack-based stat…

中等
1123

最深叶节点的最近公共祖先

Find the lowest common ancestor of the deepest leaves in a binary tree using efficient traversal and state tracking tech…

中等
1124

表现良好的最长时间段

The Longest Well-Performing Interval problem challenges you to find the longest subarray where tiring days exceed non-ti…

中等
1129

颜色交替的最短路径

Solve the shortest path problem with alternating edge colors using graph traversal and BFS.

中等
1130

叶值的最小代价生成树

Compute the minimum sum of non-leaf nodes in a binary tree formed from array leaves using dynamic programming efficientl…

中等
1131

绝对值表达式的最大值

Calculate the largest sum of absolute differences across two arrays and their indices using an efficient pattern-based a…

中等
1138

字母板上的路径

Find the path to type a target string on an alphabet board using directional moves and the 'hash table plus string' patt…

中等
1139

最大的以 1 为边界的正方形

Find the largest square of 1s with 1s on its borders in a binary grid using dynamic programming.

中等
1140

石子游戏 II

Stone Game II is a dynamic programming problem where Alice and Bob alternate taking stones from piles to maximize their …

中等
1143

最长公共子序列

Find the length of the longest common subsequence between two strings using state transition dynamic programming for eff…

中等
1144

递减元素使数组呈锯齿状

Transform any integer array into a zigzag pattern with minimal decrements using a targeted greedy approach and invariant…

中等
1145

二叉树着色游戏

A two-player game where players color nodes in a binary tree, aiming to outmaneuver each other by choosing adjacent node…

中等
1146

快照数组

Implement a SnapshotArray that efficiently tracks element changes and retrieves past states using array scanning and has…

中等
1155

掷骰子等于目标和的方法数

Calculate the number of ways to roll n dice with k faces to reach a target sum using state transition dynamic programmin…

中等
1156

单字符重复子串的最大长度

Find the maximum length of a repeated character substring after swapping two characters using a sliding window approach …

中等
1161

最大层内元素和

Find the level of a binary tree where the sum of its nodes is maximal, with an emphasis on binary-tree traversal.

中等
1162

地图分析

Find the farthest water cell from land in a grid and return the Manhattan distance using state transition dynamic progra…

中等
1169

查询无效交易

Detect invalid transactions by scanning arrays and cross-checking with hash tables for time, amount, and city conflicts …

中等
1170

比较字符串最小字母出现频次

Compare Strings by Frequency of the Smallest Character requires counting minimal character frequencies in words and quer…

中等
1171

从链表中删去总和值为零的连续节点

Remove zero-sum consecutive nodes from a linked list by iterating through it, repeatedly deleting sequences that sum to …

中等
1177

构建回文串检测

Given a string and queries, determine if a substring can be rearranged and modified to form a palindrome.

中等
1186

删除一次得到子数组最大和

Find the maximum sum of a subarray with at most one deletion in this dynamic programming problem.

中等
1190

反转每对括号间的子串

Reverse all substrings within matched parentheses using a stack-based approach for efficient state tracking and reversal…

中等
1191

K 次串联后最大子数组之和

Solve the K-Concatenation Maximum Sum problem using dynamic programming and optimal sub-array sum calculation.

中等
1201

丑数 III

Find the nth positive integer divisible by a, b, or c using binary search over the answer space efficiently and accurate…

中等
1202

交换字符串中的元素

Find the lexicographically smallest string by swapping characters in given pairs of indices.

中等
1208

尽可能使字符串相等

Optimize substring transformations using a binary search approach to maximize the change within a budget.

中等
1209

删除字符串中的所有相邻重复项 II

Remove all adjacent duplicates in the string using stack-based state management with a given threshold k.

中等
1218

最长定差子序列

Find the longest arithmetic subsequence with a given difference using dynamic programming and hash tables.

中等
1219

黄金矿工

Find the path with the maximum gold in a grid with backtracking and pruning techniques to maximize the gold collected.

中等
1222

可以攻击国王的皇后

Identify all black queens on an 8x8 chessboard that can attack the white king using array and matrix simulation techniqu…

中等
1227

飞机座位分配概率

Calculate the probability that the last passenger sits in their assigned seat using state transition dynamic programming…

中等
1233

删除子文件夹

Remove sub-folders in a filesystem by filtering out folders nested inside other folders.

中等
1234

替换子串得到平衡字符串

Determine the minimum substring length to replace in order to balance a string of Q, W, E, and R characters efficiently.

中等
1237

找出给定方程的正整数解

Determine all positive integer pairs that satisfy a hidden monotonic function for a given target using binary search ove…

中等
1238

循环码排列

Generate a circular permutation from a range of numbers using backtracking and bit manipulation.

中等
1239

串联字符串的最大长度

Find the maximum length of a concatenated string from an array with all unique characters using backtracking search with…

中等
1247

交换字符使得字符串相同

This problem requires determining the minimum number of swaps to make two strings equal by swapping characters between t…

中等
1248

统计「优美子数组」

The problem requires counting subarrays with exactly k odd numbers using an efficient array scanning approach.

中等
1249

移除无效的括号

Given a string with parentheses and letters, remove the fewest parentheses to produce any valid balanced string efficien…

中等
1253

重构 2 行二进制矩阵

Reconstruct a 2-row binary matrix by distributing column sums while respecting upper and lower row limits using greedy p…

中等
1254

统计封闭岛屿的数目

Count the number of closed islands in a 2D grid using array traversal and depth-first search efficiently.

中等
1261

在受污染的二叉树中查找元素

Recover values in a contaminated binary tree and efficiently check for existence using traversal and state tracking tech…

中等
1262

可被三整除的最大和

Find the maximum sum divisible by three from a given array using dynamic programming and state transition.

中等
1267

统计参与通信的服务器

Count Servers that Communicate involves identifying servers in a grid that can communicate based on row or column connec…

中等
1268

搜索推荐系统

Design a search suggestion system that provides the top three lexicographically smallest products matching a search word…

中等
1276

不浪费原料的汉堡制作方案

Determine the exact counts of jumbo and small burgers using all tomato and cheese slices without leftovers, applying mat…

中等
1277

统计全为 1 的正方形子矩阵

Count the number of square submatrices with all ones in a given binary matrix using dynamic programming.

中等
1282

用户分组

Organize people into groups based on their specified group sizes using array scanning and hash table bucketing efficient…

中等
1283

使结果不超过阈值的最小除数

Find the smallest divisor such that the sum of all divided array elements is less than or equal to the threshold.

中等
1286

字母组合迭代器

Implement an iterator that generates all combinations of a given length using efficient backtracking with pruning.

中等
1288

删除被覆盖区间

Remove all intervals fully covered by another using sorting and linear traversal, counting only distinct remaining inter…

中等
1291

顺次数

Find all integers within a range whose digits form a strictly increasing consecutive sequence using enumeration techniqu…

中等
1292

元素和小于等于阈值的正方形的最大边长

This problem challenges you to find the largest square in a matrix with a sum below a given threshold using binary searc…

中等
1296

划分数组为连续数字的集合

Determine if an integer array can be partitioned into sets of k consecutive numbers using array scanning and hash mappin…

中等
1297

子串的最大出现次数

Find the maximum number of occurrences of any valid substring in a given string with specific constraints on letter coun…

中等
1300

转变数组后最接近目标值的数组和

Find the integer that mutates all larger elements in an array to minimize the sum difference to a target efficiently.

中等
1302

层数最深叶子节点的和

Find the sum of the deepest leaves in a binary tree by using tree traversal and state tracking techniques.

中等
1305

两棵二叉搜索树中的所有元素

Merge elements from two binary search trees and return them sorted in ascending order.

中等
1306

跳跃游戏 III

Jump Game III challenges you to determine if you can reach any zero in an array using jumps defined by array values, tes…

中等
1310

子数组异或查询

Compute XOR results for multiple subarray queries using efficient prefix XOR to reduce repeated computation overhead in …

中等
1311

获取你好友已观看的视频

Find videos watched by friends up to a given level and return them sorted by frequency and alphabetically.

中等
1314

矩阵区域和

Compute a matrix where each cell contains the sum of all elements within k-distance blocks using prefix sums efficiently…

中等
1315

祖父节点值为偶数的节点和

This problem involves calculating the sum of nodes with an even-valued grandparent in a binary tree.

中等
1318

或运算的最小翻转次数

Determine the minimum number of bit flips required in two integers so that their OR equals a target integer efficiently.

中等
1319

连通网络的操作次数

Determine the minimum number of operations required to connect all computers in a network with a limited number of cable…

中等
1324

竖直打印单词

Transform a string into vertical columns by arranging each word character in array positions while trimming trailing spa…

中等
1325

删除给定值的叶子节点

In this problem, you need to delete all leaf nodes in a binary tree with a given target value, performing continuous del…

中等
1328

破坏回文串

Given a palindrome, change exactly one character to make it non-palindromic and lexicographically smallest using a greed…

中等
1329

将矩阵按对角线排序

Sort each diagonal of a matrix in ascending order, applying sorting and matrix traversal techniques.

中等
1333

餐厅过滤器

Filter restaurants by vegan-friendly status, price, and distance, and sort them by rating and ID.

中等
1334

阈值距离内邻居最少的城市

Find the city with the fewest neighbors within a given threshold distance using dynamic programming.

中等
1338

数组大小减半

This problem asks to minimize the set of integers removed to reduce an array's size to at least half by removing occurre…

中等
1339

分裂二叉树的最大乘积

Maximize the product of sums of two subtrees formed by splitting a binary tree.

中等
1343

大小为 K 且平均值大于等于阈值的子数组数目

Given an array, find the number of sub-arrays of size k with an average greater than or equal to a given threshold.

中等
1344

时钟指针的夹角

Calculate the smaller angle between the hour and minute hands of a clock based on given time inputs.

中等
1347

制造字母异位词的最小步骤数

Calculate the minimum steps to transform one string into an anagram of another using character replacements efficiently.

中等
1348

推文计数

Design an efficient solution to track and retrieve tweet counts over different frequencies using binary search and hash …

中等
1352

最后 K 个数的乘积

Design a data structure to efficiently return the product of the last k numbers in a dynamic integer stream using prefix…

中等
1353

最多可以参加的会议数目

Maximize the number of events you can attend given their start and end days using a greedy strategy.

中等
1357

每隔 n 个顾客打折

Compute customer bills with periodic discounts efficiently using array scanning and hash mapping for fast product price …

中等
1358

包含所有三种字符的子字符串数目

Count all substrings containing at least one of each character a, b, and c using a sliding window approach efficiently.

中等
1361

验证二叉树

Validate Binary Tree Nodes problem requires checking if a set of nodes forms a valid binary tree using graph traversal.

中等
1362

最接近的因数

Find the closest divisors of num + 1 and num + 2 with minimal absolute difference in this math-driven problem.

中等
1366

通过投票对团队排名

Rank Teams by Votes requires counting position-based votes and resolving ties with array scanning and hash lookup techni…

中等
1367

二叉树中的链表

Determine if a linked list is represented as a downward path in a binary tree using pointer traversal and recursive chec…

中等
1371

每个元音包含偶数次的最长子字符串

Find the longest substring with even counts of vowels using bitmasking and hash tables.

中等
1372

二叉树中的最长交错路径

Find the longest ZigZag path in a binary tree using depth-first search and dynamic programming for precise node state tr…

中等
1375

二进制字符串前缀一致的次数

Count how many times a 1-indexed binary string becomes prefix-aligned as bits are flipped sequentially using an array-dr…

中等
1376

通知所有员工所需的时间

Calculate the time needed for the head of a company to inform all employees using tree traversal techniques.

中等
1381

设计一个支持增量操作的栈

Implement a stack that supports push, pop, and targeted increment operations efficiently using array-based state managem…

中等
1382

将二叉搜索树变平衡

This problem requires balancing a binary search tree using in-order traversal and state tracking techniques.

中等
1386

安排电影院座位

Determine the maximum number of four-person groups that can be seated in a cinema using array scanning and hash lookup e…

中等
1387

将整数按权重排序

Sort integers in a range based on their power value using dynamic programming and memoization, handling ties with ascend…

中等
1390

四因数

Compute the sum of all divisors for numbers in an array that have exactly four divisors using array and math techniques.

中等
1391

检查网格中是否存在有效路径

Check if there is a valid path from the upper-left to the bottom-right corner of a grid using depth-first search.

中等
1395

统计作战单位数

Count the number of valid three-soldier teams using ratings with a state transition dynamic programming approach efficie…

中等
1396

设计地铁系统

Design an underground system to calculate travel times between stations using hash tables for efficient lookups and aver…

中等
1400

构造 K 个回文字符串

Determine if a string's characters can be rearranged to form exactly k non-empty palindrome strings using greedy validat…

中等
1401

圆和矩形是否有重叠

Determine if a circle intersects with an axis-aligned rectangle using geometric distance checks efficiently in code.

中等
1404

将二进制表示减到 1 的步骤数

Determine the number of steps to reduce a binary representation of a number to 1 by following specific rules.

中等
1405

最长快乐字符串

Solve the "Longest Happy String" problem using a greedy approach with validation of invariants for constructing the long…

中等
1409

查询带键的排列

This problem involves processing queries on a permutation using an array and binary indexed tree for efficient results.

中等
1410

HTML 实体解析器

Transform a string containing HTML entities into their character equivalents using a hash table for efficient parsing.

中等
1414

和为 K 的最少斐波那契数字数目

Find the minimum number of Fibonacci numbers that sum up to a given integer k, using a greedy approach.

中等
1415

长度为 n 的开心字符串中字典序第 k 小的字符串

Given n and k, find the k-th lexicographical happy string of length n using backtracking search with pruning.

中等
1418

点菜展示表

Generate a restaurant display table from orders by counting each food item per table using array scanning and hash looku…

中等
1419

数青蛙

Determine the minimum number of frogs required to sequentially produce all croaks in a mixed frog croak string efficient…

中等
1423

可获得的最大点数

Maximize your score by selecting k cards from the beginning or end of the array using a sliding window approach.

中等
1424

对角线遍历 II

Traverse a jagged 2D array diagonally by grouping elements with equal row and column sums efficiently using sorting and …

中等
1432

改变一个整数能得到的最大差值

Compute the maximum difference from changing digits in an integer using greedy choices and invariant checks efficiently.

中等
1433

检查一个字符串是否可以打破另一个字符串

This problem checks whether one string can break another using permutations and a greedy approach for comparison.

中等
1438

绝对差不超过限制的最长连续子数组

Find the longest subarray with elements whose absolute difference is within a specified limit using a sliding window app…

中等
1441

用栈操作构建数组

Simulate stack operations to match a target array while processing numbers from 1 to n.

中等
1442

形成两个异或相等数组的三元组数目

Efficiently count all triplets in an array where two subarrays formed by splitting have equal XOR using array scanning a…

中等
1443

收集树上所有苹果的最少时间

Minimize the time spent to collect all apples in a tree, considering traversal and state tracking with binary tree techn…

中等
1447

最简分数

Generate simplified fractions between 0 and 1 with denominators up to a given integer n.

中等
1448

统计二叉树中好节点的数目

Count Good Nodes in Binary Tree identifies nodes exceeding all previous values along their path using DFS traversal tech…

中等
1451

重新排列句子中的单词

Rearrange words in a sentence by their length, maintaining original order for words of equal size for consistent output.

中等
1452

收藏清单

Identify people whose favorite companies lists are unique and not subsets of any other person's list using efficient arr…

中等
1456

定长子串中元音的最大数目

Find the maximum number of vowels in a substring of a given length in a string using a sliding window approach.

中等
1457

二叉树中的伪回文路径

Count all root-to-leaf paths in a binary tree that can be rearranged to form a palindrome using bitwise state tracking.

中等
1461

检查一个字符串是否包含所有长度为 K 的二进制子串

Determine if every possible binary string of length k exists as a substring within a given binary string s efficiently u…

中等
1462

课程表 IV

Determine if one course is a prerequisite of another using graph indegree tracking and topological ordering efficiently.

中等
1465

切割后面积最大的蛋糕

Maximize the area of a piece of cake after specified horizontal and vertical cuts using greedy algorithms and sorting.

中等
1466

重新规划路线

Reorder Routes to Make All Paths Lead to the City Zero involves reversing the direction of roads in a tree to ensure all…

中等
1471

数组中的 k 个最强值

Identify the k strongest values in an array using two-pointer scanning and careful tracking of the array's centre value.

中等
1472

设计浏览器历史记录

Implement a browser history tracker with back, forward, and visit operations using linked-list pointer manipulation effi…

中等
1476

子矩形查询

Implement the SubrectangleQueries class to handle dynamic updates and value queries on a 2D rectangle.

中等
1477

找两个和为目标值且不重叠的子数组

Find two non-overlapping sub-arrays with a given target sum and return the minimal total length efficiently using array …

中等
1481

不同整数的最少数目

Find the least number of unique integers after removing exactly k elements from an array using efficient frequency count…

中等
1482

制作 m 束花所需的最少天数

Determine the minimum number of days required to make m bouquets using k adjacent flowers efficiently with binary search…

中等
1487

保证文件名唯一

This problem requires creating unique folder names by appending suffixes to duplicate names using an array scanning and …

中等
1488

避免洪水泛滥

This problem asks you to avoid flooding by deciding when to dry lakes between rain events.

中等
1492

n 的第 k 个因子

Find the kth factor of n by scanning divisors carefully or using factor pairs to skip unnecessary checks.

中等
1493

删掉一个元素以后全为 1 的最长子数组

Solve LeetCode 1493 by tracking runs of 1s around one deletion using a tight sliding window or state transition DP.

中等
1497

检查数组对是否可以被 k 整除

Check if array pairs are divisible by k by pairing elements whose sums are divisible by k using array scanning and hash …

中等
1498

满足条件的子序列数目

Count all non-empty subsequences in an integer array where the sum of the minimum and maximum elements is at most a targ…

中等
1503

所有蚂蚁掉下来前的最后一刻

This problem involves simulating ant movement on a plank to determine the last moment before all ants fall off.

中等
1504

统计全 1 子矩形

Count Submatrices With All Ones is a dynamic programming problem focusing on submatrix counting using an efficient row-b…

中等
1508

子数组和排序后的区间和

Compute the sum of sorted subarray sums efficiently using binary search over valid sum ranges and prefix sum accumulatio…

中等
1509

三次操作后最大值与最小值的最小差

Find the minimum difference between the largest and smallest values in an array after performing at most three moves.

中等
1513

仅含 1 的子串数

Calculate the number of contiguous substrings containing only 1s in a binary string using a math and string approach eff…

中等
1514

概率最大的路径

Find the path with the highest success probability in a graph from a start node to an end node, using edge probabilities…

中等
1519

子树中标签相同的节点数

Compute the number of nodes in each subtree sharing the same label using DFS with hash table aggregation efficiently.

中等
1524

和为奇数的子数组数目

Count the number of subarrays with an odd sum using dynamic programming and prefix sum techniques.

中等
1525

字符串的好分割数目

Count all valid splits of a string where left and right substrings have equal distinct characters, using efficient state…

中等
1529

最少的后缀翻转次数

Find the minimum number of operations to convert a binary string to a target string using bit flips.

中等
1530

好叶子节点对的数量

Find the number of good leaf node pairs in a binary tree where the shortest path between them is less than or equal to a…

中等
1535

找出数组游戏的赢家

Determine the integer that wins an array game by achieving k consecutive victories through simulated pairwise comparison…

中等
1536

排布二进制网格的最少交换次数

Compute the minimum number of adjacent row swaps to transform a binary grid so all upper-triangle cells are zero using a…

中等
1540

K 次操作转变字符串

Determine if string s can be transformed into t within k moves using character shifts and hash table counting efficientl…

中等
1541

平衡括号字符串的最少插入次数

Compute the minimum insertions to transform a parentheses string into a balanced string using efficient stack tracking.

中等
1545

找出第 N 个二进制字符串中的第 K 位

Determine the k-th bit in the n-th binary string using a recursive construction that inverts and reverses previous strin…

中等
1546

和为目标值且不重叠的非空子数组的最大数目

Find the maximum number of non-overlapping subarrays that sum to a given target using efficient scanning and hash lookup…

中等
1551

使数组中所有元素相等的最小操作数

Compute the minimum number of operations to equalize a sequential odd-number array using a precise math-driven approach.

中等
1552

两球之间的磁力

Maximize the minimum magnetic force between balls by strategically placing them in baskets using binary search on positi…

中等
1557

可以到达所有点的最少点数目

Identify the minimum set of vertices in a directed acyclic graph from which all nodes are reachable efficiently using gr…

中等
1558

得到目标数组的最少函数调用次数

Calculate the minimum number of modify calls needed to convert an all-zero array into a given target array using greedy …

中等
1559

二维网格图中探测环

Detect cycles in a 2D character grid using DFS while carefully tracking parent cells to avoid invalid revisits.

中等
1561

你可以获得的最大硬币数目

Solve the Maximum Number of Coins You Can Get using greedy pile selection and invariant validation to maximize your coin…

中等
1562

查找大小为 M 的最新分组

Determine the latest step where a contiguous group of ones of exact length m exists using array scanning and hash tracki…

中等
1567

乘积为正数的最长子数组长度

Given an array, find the maximum length of a subarray with a positive product using dynamic programming.

中等
1573

分割字符串的方案数

Count the number of ways to split a binary string into three non-empty parts with equal numbers of '1's.

中等
1574

删除最短的子数组使剩余数组有序

Find the shortest subarray to remove in order to make an array non-decreasing using binary search and two-pointer techni…

中等
1577

数的平方等于两数乘积的方法数

Find the number of triplets where the square of a number equals the product of two others, utilizing array scanning and …

中等
1578

使绳子变成彩色的最短时间

Minimize the time Bob needs to remove balloons to make a rope colorful using dynamic programming with state transitions.

中等
1583

统计不开心的朋友

Determine the number of unhappy friends in paired arrangements using array-based simulation for preference violations.

中等
1584

连接所有点的最小费用

Min Cost to Connect All Points asks for the minimum cost to connect all points on a 2D plane, using manhattan distances …

中等
1589

所有排列中的最大和

Maximize the total sum of requests on nums by greedily assigning larger numbers to most frequently requested indices.

中等
1590

使数组和能被 P 整除

Determine the minimum-length subarray to remove so the remaining array sum is divisible by a given integer p efficiently…

中等
1593

拆分字符串使唯一子字符串的数目最大

Maximize unique substrings in a string using backtracking with pruning and hash tables to track substrings.

中等
1594

矩阵的最大非负积

Find the maximum non-negative product path in a matrix using dynamic programming and state transition.

中等
1599

经营摩天轮的最大利润

Maximize the profit from operating a Centennial Wheel by determining the optimal number of rotations based on customer a…

中等
1600

王位继承顺序

Throne Inheritance requires modeling a dynamic family tree with births and deaths to determine the kingdom's inheritance…

中等
1604

警告一小时内使用相同员工卡大于等于三次的人

Solve LeetCode 1604 by grouping swipe times per employee, sorting each list, and scanning for any three within 60 minute…

中等
1605

给定行和列的和求可行矩阵

Given row and column sums, find any valid matrix of non-negative integers that satisfies them.

中等
1609

奇偶树

Determine if a binary tree meets Even-Odd rules by checking value parity and strict ordering at each level efficiently.

中等
1615

最大网络秩

Calculate the maximum network rank of two cities by analyzing all city pairs using a graph-driven solution strategy effi…

中等
1616

分割两个字符串得到回文串

Determine if splitting two equal-length strings at a common index can form a palindrome using two-pointer scanning techn…

中等
1620

网络信号最好的坐标

Determine the coordinate with the maximum network quality by summing signal strengths from all reachable towers efficien…

中等
1621

大小为 K 的不重叠线段的数目

Count all valid arrangements of k non-overlapping line segments on n points using state transition dynamic programming.

中等
1625

执行操作后字典序最小的字符串

Optimize a string through rotations and additions to get the lexicographically smallest possible result using string man…

中等
1626

无矛盾的最佳球队

Find the highest score basketball team by choosing players without conflicts in age and score using dynamic programming.

中等
1630

等差子数组

Determine whether subarrays of a given array can be rearranged to form arithmetic sequences using array scanning and has…

中等
1631

最小体力消耗路径

Find the minimum effort required to travel from the top-left to the bottom-right of a grid, considering height differenc…

中等
1638

统计只差一个字符的子串数目

Count all substrings from s that differ by exactly one character from some substring in t using precise substring compar…

中等
1641

统计字典序元音字符串的数目

Calculate the number of length-n strings with vowels only that are sorted lexicographically using state transitions.

中等
1642

可以到达的最远建筑

Furthest Building You Can Reach explores a greedy approach with heap-based optimization to find the maximum reachable bu…

中等
1647

字符频次唯一的最小删除次数

Determine the minimum deletions needed to ensure all character frequencies in a string are unique using a greedy approac…

中等
1648

销售价值减少的颜色球

Maximize total value by greedily selling diminishing-valued colored balls based on inventory and customer orders.

中等
1653

使字符串平衡的最少删除次数

Determine the minimum number of deletions to transform a string of 'a' and 'b' into a balanced order using DP.

中等
1654

到家的最少跳跃次数

Find the minimum number of jumps needed to reach a target position while avoiding forbidden positions.

中等
1657

确定两个字符串是否接近

Check if two strings can transform into each other using letter swaps and frequency reorganizations, leveraging hash tab…

中等
1658

将 x 减到 0 的最小操作数

Find the minimum number of operations to reduce a value x to zero by removing elements from an array.

中等
1663

具有给定数值的最小字符串

Find the lexicographically smallest string of length n with a given numeric value k using a greedy approach.

中等
1664

生成平衡数组的方案数

Solve Ways to Make a Fair Array by tracking parity sums before and after each removal with prefix-sum style accounting.

中等
1669

合并两个链表

Merge a second linked list into a first by removing a specified range of nodes, testing precise pointer updates and list…

中等
1670

设计前中后队列

Implement a queue that efficiently handles push and pop operations at the front, middle, and back using pointer manipula…

中等
1673

找出最具竞争力的子序列

Identify the lexicographically smallest subsequence of size k using stack-based greedy selection in array traversal.

中等
1674

使数组互补的最少操作次数

Find the minimum moves to make an array complementary by analyzing paired sums and using hash lookups for efficiency.

中等
1679

K 和数对的最大数目

Max Number of K-Sum Pairs is a problem involving counting disjoint pairs with a given sum k in an array.

中等
1680

连接连续二进制数字

Calculate the decimal value of concatenated binary numbers from 1 to n using efficient bit manipulation techniques.

中等
1685

有序数组中差绝对值之和

Calculate the sum of absolute differences between each element and others in a sorted array efficiently.

中等
1686

石子游戏 VI

Determine the winner in Stone Game VI using a greedy strategy that accounts for each stone's dual value impact on Alice …

中等
1689

十-二进制数的最少数目

This problem asks to find the minimum number of deci-binary numbers needed to sum to a given number represented as a str…

中等
1690

石子游戏 VII

Maximize score difference in a two-player turn-based stone removal game using state transition dynamic programming.

中等
1695

删除子数组的最大得分

Maximize the score by erasing a subarray with unique elements in an array of integers.

中等
1696

跳跃游戏 VI

Jump Game VI challenges you to maximize your score while jumping through an array using state transition dynamic program…

中等
1701

平均等待时间

Compute the average waiting time for customers using array traversal and simulation of a single chef processing orders s…

中等
1702

修改后的最大二进制字符串

The problem asks to maximize a binary string using specific operations to get the highest possible value.

中等
1705

吃苹果的最大数目

Maximize apples eaten by choosing the best apples first, considering their rot days and available days to eat them.

中等
1706

球会落何处

Determine where each ball exits a diagonal board grid or if it gets stuck, using matrix simulation with careful traversa…

中等
1711

大餐计数

Count Good Meals asks you to find pairs of food items with a sum of deliciousness equal to a power of two.

中等
1712

将数组分成三个子数组的方案数

The problem requires finding the number of ways to split an array into three subarrays where each split meets a certain …

中等
1717

删除子字符串的最大得分

Compute the highest score by greedily removing specific substrings using a stack to track state transitions efficiently.

中等
1718

构建字典序最大的可行序列

Construct the Lexicographically Largest Valid Sequence problem involves finding the largest sequence with backtracking a…

中等
1721

交换链表中的节点

Swap nodes in a linked list using linked-list pointer manipulation and two pointers to solve this medium difficulty prob…

中等
1722

执行交换操作后的最小汉明距离

Solve Minimize Hamming Distance After Swap Operations by grouping swappable indices and matching value counts inside eac…

中等
1726

同积元组

Given an array of distinct integers, return the number of tuples where the product of two pairs is the same.

中等
1727

重新排列后的最大子矩阵

Rearrange columns of a binary matrix to find the largest submatrix of 1s.

中等
1733

需要教语言的最少人数

Minimize the number of users to teach a language that ensures all friends can communicate in a social network.

中等
1734

解码异或后的排列

Decode XORed Permutation uses prefix reconstruction with global XOR to recover the hidden odd-length permutation in line…

中等
1737

满足三条件之一需改变的最少字符数

This problem asks for the minimum operations to change two strings so that one of three conditions is met.

中等
1738

找出第 K 大的异或坐标值

Compute the kth largest XOR coordinate in a 2D matrix using prefix sums, bit manipulation, and optimized selection techn…

中等
1743

从相邻元素对还原数组

Restore the Array From Adjacent Pairs reconstructs a sequence using adjacent element pairs. Efficient hash lookups and a…

中等
1744

你能在你最喜欢的那天吃到你最喜欢的糖果吗?

Determine if you can eat a candy of your favorite type on a specific day, given daily limits and candy availability.

中等
1749

任意子数组和的绝对值的最大值

Solve for the maximum absolute sum of any subarray using dynamic programming and understanding state transitions.

中等
1750

删除字符串两端相同字符后的最短长度

Minimize string length by deleting similar characters from both ends repeatedly using a two-pointer technique.

中等
1753

移除石子的最大得分

Maximize the score in a solitaire game by optimally removing stones from three piles with a greedy approach.

中等
1754

构造字典序最大的合并字符串

Construct the lexicographically largest merge from two strings using a two-pointer greedy scanning approach efficiently.

中等
1759

统计同质子字符串的数目

This problem requires counting all homogenous substrings in a given string and returning the result modulo 10^9 + 7.

中等
1760

袋子里最少数目的球

Find the minimum penalty (maximum balls in a bag) after performing up to maxOperations to split bags of balls.

中等
1764

通过连接另一个数组的子数组得到一个数组

Determine if you can sequentially select disjoint subarrays from nums matching each group in order using two-pointer sca…

中等
1765

地图中的最高点

Solve the Map of Highest Peak problem using breadth-first search to assign heights based on proximity to water cells.

中等
1769

移动所有球到每个盒子所需的最小操作数

Solve the problem of finding the minimum operations to move balls to each box using an efficient approach with arrays an…

中等
1774

最接近目标价格的甜点成本

Find the closest dessert cost to a target by selecting from a list of base flavors and topping combinations using dynami…

中等
1775

通过最少操作次数使数组的和相等

Solve the problem of balancing the sums of two integer arrays with minimal operations, using array scanning and hash loo…

中等
1780

判断一个数字是否可以表示成三的幂的和

Determine if a number can be expressed as the sum of distinct powers of three using a math-driven strategy.

中等
1781

所有子字符串美丽值之和

Calculate the total beauty of all substrings by counting character frequencies and computing frequency differences effic…

中等
1785

构成特定和需要添加的最少元素

Compute the gap between current sum and goal, then greedily cover it with limit-sized additions to get the minimum count…

中等
1786

从第一个节点出发到最后一个节点的受限路径数

Solve the problem of finding the number of restricted paths in a weighted undirected graph, leveraging graph algorithms …

中等
1792

最大平均通过率

Maximize the average pass ratio by assigning extra guaranteed-passing students using a greedy heap strategy for optimal …

中等
1797

设计一个验证系统

Implement an AuthenticationManager using linked-list pointer manipulation and a hash map to track token expirations effi…

中等
1798

你能构造出连续值的最大数目

Find the maximum number of consecutive integer values starting from zero that can be formed using your coins array.

中等
1801

积压订单中的订单总数

Determine the total number of unfulfilled buy and sell orders using heaps to simulate backlog processing efficiently in …

中等
1802

有界数组中指定下标处的最大值

Maximize the value at a given index of an array with constraints using binary search over the valid answer space.

中等
1806

还原排列的最少操作步数

Find the minimum number of operations to reinitialize a permutation of size n using specific operations.

中等
1807

替换字符串中的括号内容

Quickly evaluate a string with bracketed keys using array scanning and hash table lookups for efficient replacements.

中等
1813

句子相似性 III

Sentence Similarity III asks if one sentence can be transformed into another by inserting a sentence inside it.

中等
1814

统计一个数组中好对子的数目

Count Nice Pairs in an Array requires efficiently pairing numbers where nums[i] + rev(nums[j]) equals nums[j] + rev(nums…

中等
1817

查找用户活跃分钟数

This problem requires counting unique minutes of user activity on LeetCode based on a series of logs and an integer k.

中等
1818

绝对差值和

Minimize the absolute sum difference between two integer arrays by replacing at most one element from the first array.

中等
1823

找出游戏的获胜者

Find the winner of a circular game by simulating the elimination process with a queue-driven approach.

中等
1824

最少侧跳次数

Solve the Minimum Sideway Jumps problem using state transition dynamic programming to minimize side jumps while navigati…

中等
1828

统计一个圆中点的数目

Determine how many 2D points lie within multiple circles using array iteration and Euclidean distance calculations effic…

中等
1829

每个查询的最大异或值

Find the maximum XOR for each query based on a sorted array and bit manipulation.

中等
1833

雪糕的最大数量

Maximize the number of ice cream bars a boy can buy by applying a greedy choice strategy based on cost sorting.

中等
1834

单线程 CPU

Simulate task processing with a single-threaded CPU by sorting and prioritizing tasks based on arrival and processing ti…

中等
1838

最高频元素的频数

Maximize the frequency of an element in an array by incrementing at most `k` elements. Use binary search and greedy tech…

中等
1839

所有元音按顺序排布的最长子字符串

Find the longest substring of all vowels in order within a given string of vowels using sliding window technique.

中等
1845

座位预约管理系统

Manage seat reservations efficiently using a design combining priority queue to always return the lowest available seat …

中等
1846

减小和重新排列数组后的最大元素

Determine the maximum value in an array after decreasing elements and rearranging using a greedy invariant approach.

中等
1849

将字符串拆分为递减的连续值

Check if a string of digits can be split into descending consecutive values where the difference between them is 1.

中等
1850

邻位交换的最小次数

Find the minimum number of adjacent swaps to reach the kth smallest wonderful integer from a given number string.

中等
1855

下标对中的最大距离

Find the maximum distance between a pair of values in two non-increasing integer arrays using binary search.

中等
1856

子数组最小乘积的最大值

The problem asks to find the maximum min-product of any non-empty subarray of nums.

中等
1860

增长的内存泄露

Solve Incremental Memory Leak by simulating each second carefully and using math to reason about the crash time bound.

中等
1861

旋转盒子

Rotate a box represented by a character matrix, letting stones fall under gravity using precise two-pointer scanning and…

中等
1864

构成交替字符串需要的最小交换次数

This problem requires finding the minimum number of swaps to make a binary string alternating or determine if it's impos…

中等
1865

找出和为指定值的下标对

Efficiently track and count pairs across two arrays using array scanning plus hash lookup to support dynamic updates.

中等
1870

准时到达的列车最小时速

This problem asks to find the minimum speed of trains to reach on time using binary search.

中等
1871

跳跃游戏 VII

The problem asks to determine if we can reach the last index of a binary string, with a set range of jumps between indic…

中等
1877

数组中最大数对和的最小值

Minimize the maximum pair sum in an array by optimally pairing its elements.

中等
1878

矩阵中最大的三个菱形和

Find the three largest distinct rhombus sums from a given grid using array and math techniques.

中等
1881

插入后的最大值

Solve Maximum Value after Insertion by greedily placing x at the first digit that makes the resulting signed number larg…

中等
1882

使用服务器处理任务

Assign tasks to servers efficiently using arrays and heaps, resolving ties by weight and index while tracking availabili…

中等
1884

鸡蛋掉落-两枚鸡蛋

Determine the minimum drops needed to find the critical floor using 2 eggs with optimized state transition dynamic progr…

中等
1887

使数组元素相等的减少操作次数

Find the minimum number of operations to make all array elements equal by reducing the largest elements to the next smal…

中等
1888

使二进制字符串字符交替的最少反转次数

Find the minimum number of flips to make a binary string alternate, using state transition dynamic programming.

中等
1894

找到需要补充粉笔的学生编号

Identify the first student who will run out of chalk using a simulation with prefix sums and binary search.

中等
1895

最大的幻方

Find the side length of the largest magic square in a matrix where row, column, and diagonal sums are equal.

中等
1898

可移除字符的最大数目

Use binary search and a subsequence check to find the largest removable prefix that still keeps p inside s.

中等
1899

合并若干三元组以形成目标三元组

Determine if target triplet can be formed by merging given triplets using greedy selection and invariant checks.

中等
1901

寻找峰值 II

Locate any peak in a 2D matrix using binary search across rows or columns for efficient discovery and verification.

中等
1904

你完成的完整对局数

Solve this math plus string problem to calculate the number of full rounds played in a chess tournament between login an…

中等
1905

统计子岛屿

Identify and count all islands in grid2 that are fully contained within islands of grid1 using DFS traversal efficiently…

中等
1906

查询差绝对值的最小值

Compute minimum absolute differences for subarrays efficiently using array scanning and hash table lookups, leveraging b…

中等
1910

删除一个字符串中所有出现的给定子字符串

Remove all occurrences of a specified substring from a string using efficient stack-based state management.

中等
1911

最大交替子序列和

Maximize alternating subsequence sum with dynamic programming and state transitions in an array.

中等
1914

循环轮转矩阵

This problem requires cyclically rotating a grid by rotating each layer of the matrix counter-clockwise for a specified …

中等
1915

最美子字符串的数目

Count the number of wonderful non-empty substrings of a given string based on frequency conditions of characters.

中等
1921

消灭怪物的最大数量

Eliminate monsters by strategically using a weapon in a video game to stop them before they reach your city.

中等
1922

统计好数字的数目

Count Good Numbers uses a mathematical pattern with recursion to efficiently count digit strings of length n under stric…

中等
1926

迷宫中离入口最近的出口

Find the shortest path from the maze entrance to the nearest border exit using BFS over a 2D array matrix efficiently.

中等
1927

求和游戏

Determine if Alice can force a win in the Sum Game by strategically replacing '?' using a greedy and invariant approach.

中等
1930

长度为 3 的不同回文子序列

Count all unique length-3 palindromic subsequences in a string efficiently using hash tables and character positions.

中等
1936

新增的最少台阶数

Determine the fewest rungs to add to climb a strictly increasing ladder using a greedy step-by-step approach.

中等
1937

扣分后的最大得分

Maximize your points in a matrix by selecting cells row by row while accounting for distance penalties using dynamic pro…

中等
1942

最小未被占据椅子的编号

Solve The Number of the Smallest Unoccupied Chair by sorting arrivals and managing freed seats before each new assignmen…

中等
1943

描述绘画结果

Solve the problem of describing a painted segment with mixed colors using array scanning and hash table lookups.

中等
1946

子字符串突变后可能得到的最大整数

Find the largest integer by mutating a substring of a number using a mapping array for each digit.

中等
1947

最大兼容性评分和

Assign students to mentors to maximize total compatibility using state transition dynamic programming with bitmask optim…

中等
1953

你可以工作的最大周数

Maximize the number of weeks you can work on projects with milestone constraints using a greedy approach and invariant v…

中等
1954

收集足够苹果的最小花园周长

Find the minimum perimeter of a square garden that holds enough apples based on a specific formula involving binary sear…

中等
1958

检查操作是否合法

Determine if a move on an 8x8 board is legal by validating lines in all directions using array and matrix patterns.

中等
1959

K 次调整数组大小浪费的最小总空间

Find the minimum total space wasted in a dynamic array with at most k resizing operations.

中等
1962

移除石子使总数最小

Minimize the total stones by repeatedly removing half from the largest pile using a greedy heap strategy.

中等
1963

使字符串平衡的最小交换次数

Determine the minimum swaps to balance a bracket string using two-pointer scanning with invariant tracking efficiently.

中等
1968

构造元素不等于两相邻元素平均值的数组

Rearrange an array such that no element equals the average of its neighbors using a greedy approach.

中等
1969

数组元素的最小非零乘积

The problem asks to minimize the product of an array after performing bit-swapping operations on its binary representati…

中等
1975

最大方阵和

Maximize the sum of an n x n integer matrix using row and column negation operations efficiently with a greedy approach.

中等
1976

到达目的地的方案数

Find the number of ways to travel from intersection 0 to n - 1 in the shortest time, using a graph-based approach.

中等
1980

找出不同的二进制字符串

Find a binary string of length n not in the input array using array scanning and hash lookup efficiently.

中等
1981

最小化目标值与所选元素的差

This problem asks to select one element per row to minimize the absolute difference from a target sum using dynamic prog…

中等
1985

找出数组中的第 K 大整数

This problem asks to find the kth largest integer in an array of string numbers, highlighting sorting and string-based c…

中等
1986

完成任务的最少工作时间段

Find the minimum number of work sessions needed to finish a set of tasks, considering task durations and session time.

中等
1992

找到所有的农场组

Identify all rectangular farmland groups in a binary matrix using array traversal and depth-first search efficiently.

中等
1993

树上的操作

Design a tree data structure that allows locking, unlocking, and upgrading nodes with user-specific actions.

中等
1996

游戏中弱角色的数量

Identify all weak characters in a game by analyzing attack and defense values using a stack-based greedy sorting approac…

中等
1997

访问完所有房间的第一天

Calculate the first day you have visited all rooms using state transition dynamic programming on the nextVisit array.

中等
2001

可互换矩形的组数

Count all pairs of rectangles that share the exact width-to-height ratio using efficient array scanning and hash lookup.

中等
2002

两个回文子序列长度的最大乘积

Find two disjoint palindromic subsequences in a string to maximize the product of their lengths efficiently using dynami…

中等
2007

从双倍数组中还原原数组

Given a shuffled array, determine if it is a doubled array and find the original array.

中等
2008

出租车的最大盈利

Maximize earnings by optimizing taxi ride selection and tips using array scanning, hash lookups, and sorting.

中等
2012

数组美丽值求和

Calculate the sum of beauty for array elements using prefix and suffix tracking to optimize evaluation across indices ef…

中等
2013

检测正方形

Detect Squares requires tracking points on a 2D plane to quickly count all possible axis-aligned squares using efficient…

中等
2017

网格游戏

Solve the Grid Game problem by optimizing the movement of two robots on a 2D matrix grid.

中等
2018

判断单词是否能放入填字游戏内

Determine if a word fits in a crossword grid using array and matrix checks, accounting for spaces, letters, and blocked …

中等
2023

连接后等于目标字符串的字符串对

Count all unique index pairs in a string array whose concatenation exactly matches the given target string using efficie…

中等
2024

考试的最大困扰度

Maximize the Confusion of an Exam requires adjusting at most k answers to create the longest consecutive true or false s…

中等
2028

找出缺失的观测数据

Given a set of dice rolls, calculate the missing observations based on the mean and return them or determine if it's imp…

中等
2029

石子游戏 IX

In the Stone Game IX problem, Alice and Bob take turns removing stones, and Alice wins if the sum of removed stones is d…

中等
2033

获取单值网格的最小操作数

Determine the fewest additions or subtractions of x to make all grid elements identical using array and math logic.

中等
2034

股票价格波动

Design an efficient algorithm for managing stock price fluctuations with incorrect and unordered data in a data stream.

中等
2038

如果相邻两个颜色均相同则删除当前颜色

Alice and Bob play a game removing colored pieces; Alice wins if she makes the last valid move.

中等
2039

网络空闲的时刻

Calculate the time when the network becomes idle, factoring in message resending and the BFS traversal method.

中等
2043

简易银行系统

Design a simple bank system that processes transactions like withdrawals, deposits, and transfers while managing account…

中等
2044

统计按位或能得到最大值的子集数目

Determine the number of non-empty subsets that achieve the maximum bitwise OR using efficient backtracking and pruning s…

中等
2048

下一个更大的数值平衡数

Find the smallest numerically balanced number greater than a given integer using backtracking search and pruning.

中等
2049

统计最高分的节点数目

Find the number of nodes with the highest score in a binary tree, based on subtree sizes and node removal.

中等
2054

两个最好的不重叠活动

Maximize the total value of at most two non-overlapping events using state transition dynamic programming efficiently.

中等
2055

蜡烛之间的盘子

Determine the number of plates between candles in a given substring using binary search and prefix sum techniques.

中等
2058

找出临界点之间的最小和最大距离

Find the minimum and maximum number of nodes between critical points in a linked list by identifying local minima and ma…

中等
2059

转化数字的最小运算数

Determine the minimum operations needed to convert a number using array elements with addition, subtraction, or XOR oper…

中等
2063

所有子字符串中的元音

Compute the total number of vowels in all substrings of a given string using efficient state transition dynamic programm…

中等
2064

分配给商店的最多商品的最小值

Distribute products to stores so the largest store allocation is minimized using binary search over possible maximums.

中等
2069

模拟行走机器人 II

The Walking Robot Simulation II problem challenges you to simulate robot movements and track its position and direction …

中等
2070

每一个查询的最大美丽值

Determine the maximum beauty of items affordable for each query using efficient binary search and sorting techniques.

中等
2074

反转偶数长度组的节点

Reverse nodes in even length groups while keeping the odd-length groups intact in a given linked list.

中等
2075

解码斜向换位密码

Decode the Slanted Ciphertext problem requires decoding a slanted cipher using string manipulation and simulation based …

中等
2079

给植物浇水

Simulate watering plants while managing a watering can's capacity, considering distance and refills.

中等
2080

区间内查询数字的频率

Design a data structure to handle efficient frequency queries for subarrays, focusing on hash-based lookups and efficien…

中等
2086

喂食仓鼠的最小食物桶数

Find the minimum number of food buckets required to feed all hamsters, using dynamic programming and greedy techniques.

中等
2087

网格图中机器人回家的最小代价

Find the minimum cost for a robot to return home in a grid with row and column movement costs.

中等
2090

半径为 k 的子数组平均值

Efficiently calculate the k-radius average for subarrays using sliding window technique.

中等
2091

从数组中移除最大值和最小值

The problem asks to remove the minimum and maximum elements from an array with the fewest deletions.

中等
2095

删除链表的中间节点

Efficiently remove the middle node from a linked list using two-pointer techniques and careful pointer updates to mainta…

中等
2096

从二叉树一个节点到另一个节点每一步的方向

Find the shortest path between two nodes in a binary tree and output the directions as a string of 'L', 'R', and 'U'.

中等
2100

适合野炊的日子

Find good days to rob the bank by identifying days with non-increasing and non-decreasing guard counts using dynamic pro…

中等
2101

引爆最多的炸弹

Determine the maximum number of bombs that can be detonated by leveraging chain reactions using graph traversal and DFS …

中等
2104

子数组范围和

Compute the total sum of ranges for all contiguous subarrays efficiently using stack-based state management techniques.

中等
2105

给植物浇水 II

Simulate watering a row of plants with Alice and Bob using two-pointer scanning, tracking refills precisely for each ste…

中等
2109

向字符串添加空格

Learn to efficiently insert spaces in a string using two-pointer scanning with invariant tracking in linear time.

中等
2110

股票平滑下跌阶段的数目

Count all contiguous periods where stock prices descend smoothly by exactly one using dynamic programming techniques.

中等
2115

从给定原材料中找到所有可以做出的菜

Determine all recipes you can prepare given initial supplies and ingredient dependencies, leveraging array scanning and …

中等
2116

判断一个括号字符串是否有效

Determine if a parentheses string can be transformed into a valid sequence considering locked positions using stack logi…

中等
2120

执行所有后缀指令

Simulate robot moves from every instruction index on an n x n grid, counting valid steps without leaving boundaries.

中等
2121

相同元素的间隔之和

Solve the problem of calculating intervals between identical elements using array scanning and hash lookup.

中等
2125

银行中的激光束数量

Calculate total laser beams in a bank floor plan using array counting and math logic between security devices on differe…

中等
2126

摧毁小行星

This problem requires destroying asteroids by choosing the right order of collisions based on mass, using a greedy appro…

中等
2130

链表最大孪生和

Find the maximum twin sum in a linked list by manipulating pointers efficiently and leveraging stack or reversal techniq…

中等
2131

连接两字母单词得到的最长回文串

Find the maximum-length palindrome by combining two-letter words using array scanning and hash table lookups efficiently…

中等
2134

最少交换次数来组合所有的 1 II

Solve the minimum swaps to group all 1's together in a circular binary array using an optimized sliding window approach.

中等
2135

统计追加字母可以获得的单词数

Given startWords and targetWords, check how many targetWords can be formed by adding one letter and rearranging letters …

中等
2139

得到目标值的最少行动次数

Calculate the fewest steps to reach a target integer using increments and limited doubles with a greedy strategy.

中等
2140

解决智力问题

Maximize points in an exam with state transition dynamic programming by deciding whether to solve or skip each question.

中等
2145

统计隐藏数组数目

Given a sequence of differences, count how many hidden sequences fit within a range using an array and prefix sum approa…

中等
2146

价格范围内最高排名的 K 样物品

Use BFS to rank reachable shop items by distance, price, row, and column, then return the best k coordinates.

中等
2149

按符号重排数组

Rearrange an array by alternating positive and negative integers using a two-pointer approach with invariant tracking.

中等
2150

找出数组中的所有孤独数字

Find lonely numbers in an array where each lonely number appears once and has no adjacent values.

中等
2155

分组得分最高的所有下标

Find all indices in a binary array where division score is maximized.

中等
2161

根据给定数字划分数组

Rearrange an array around a pivot while maintaining relative order using a two-pointer scanning approach efficiently.

中等
2162

设置时间的最少代价

Calculate the minimum fatigue to set a microwave cooking time using digit moves and pushes efficiently.

中等
2165

重排数字的最小值

Rearrange the digits of an integer to minimize its value while avoiding leading zeros, keeping the sign unchanged.

中等
2166

设计位集

Master the Design Bitset problem by efficiently managing bit flips, counts, and indexed updates with array and hash look…

中等
2170

使数组变成交替数组的最少操作数

Given an array, calculate the minimum number of operations needed to make it alternating.

中等
2171

拿出最少数目的魔法豆

Determine the minimum beans to remove so all remaining non-empty bags have equal beans using a greedy approach.

中等
2177

找到和为给定整数的三个连续整数

Given a number, find three consecutive integers that sum to it, or return an empty array if no such integers exist.

中等
2178

拆分成最多数目的正偶数之和

Determine the largest set of unique positive even integers that sum to a given finalSum using backtracking and greedy se…

中等
2181

合并零之间的节点

This problem requires merging nodes between zeros in a linked list by summing up the values between consecutive zeros.

中等
2182

构造限制重复的字符串

Construct a lexicographically largest string from a given string with no letter appearing more than a repeatLimit times …

中等
2186

制造字母异位词的最小步骤数 II

Compute the fewest character insertions needed to turn two strings into anagrams using hash table frequency counts effic…

中等
2187

完成旅途的最少时间

Find the minimum time required for buses to complete at least totalTrips using binary search over time multiples.

中等
2191

将杂乱无章的数字排序

Sort numbers based on a custom mapping of their digits, leveraging array manipulation and sorting techniques.

中等
2192

有向无环图中一个节点的所有祖先

Solve the All Ancestors of a Node in a Directed Acyclic Graph problem using graph traversal techniques like BFS, DFS, an…

中等
2195

向数组中追加 K 个整数

In this problem, you need to append k unique positive integers to a given array nums such that the sum is minimized.

中等
2196

根据描述创建二叉树

Build a binary tree from descriptions of parent-child relationships using array scanning and hash lookup.

中等
2201

统计可以提取的工件

Count the number of artifacts that can be extracted after excavating specified grid cells.

中等
2202

K 次操作后最大化顶端元素

Maximize the topmost element in a pile after making exactly k moves using a greedy strategy and invariant checks.

中等
2207

字符串中最多数目的子序列

Maximize the number of subsequences by optimally adding a character to a given string to match a specified pattern.

中等
2208

将数组和减半的最少操作次数

Minimize operations to halve an array's sum using greedy choices and heap data structures.

中等
2211

统计道路上的碰撞次数

Count Collisions on a Road is a problem where you calculate the number of car collisions based on their movements in a s…

中等
2212

射箭比赛中的最大得分

In the "Maximum Points in an Archery Competition" problem, Bob aims to maximize his score while respecting Alice's arrow…

中等
2216

美化数组的最少删除数

Determine the minimum deletions required to transform an array into a beautiful sequence using stack-based state managem…

中等
2217

找到指定长度的回文数

Find the smallest palindromes of a given length for specific queries with mathematical and array manipulation.

中等
2221

数组的三角和

The problem asks for calculating the triangular sum of an array through repeated pairwise summation.

中等
2222

选择建筑的方案数

Solve Number of Ways to Select Buildings by counting alternating 3-building patterns with state transitions over the bin…

中等
2225

找出输掉零场或一场比赛的玩家

Identify players with zero or one losses by efficiently scanning arrays and counting losses using hash lookups for accur…

中等
2226

每个小孩最多能分到多少糖果

Maximize candies allocation for k children by dividing piles into sub-piles using binary search.

中等
2232

向表达式添加括号后的最小结果

Enumerate every valid parenthesis placement around the plus sign and choose the expression with the smallest evaluated p…

中等
2233

K 次增加后的最大乘积

Maximize the product of an array after performing up to k increments using a greedy approach with heap optimization.

中等
2240

买钢笔和铅笔的方案数

Calculate all distinct ways to spend a fixed total on pens and pencils using a straightforward enumeration strategy.

中等
2241

设计一个 ATM 机器

Design an ATM machine that stores and withdraws money with given denominations and prioritizes larger values during with…

中等
2244

完成所有任务需要的最少轮数

The problem requires finding the minimum rounds to complete tasks, focusing on greedy algorithms and hash table lookups.

中等
2245

转角路径的乘积中最多能有几个尾随零

Find the maximum trailing zeros in the product of a cornered path within a 2D grid.

中等
2249

统计圆内格点数目

Count the number of lattice points inside at least one circle in a grid, based on given center and radius data.

中等
2250

统计包含每个点的矩形数目

Given a set of rectangles and points, determine how many rectangles contain each point.

中等
2256

最小平均差

Find the index with the minimum average difference in an array using prefix sums.

中等
2257

统计网格图中没有被保卫的格子数

Solve Count Unguarded Cells in the Grid by marking guard sight lines across a blocked matrix and counting untouched empt…

中等
2260

必须拿起的最小连续卡牌数

Solve Minimum Consecutive Cards to Pick Up by tracking each card's last index and minimizing duplicate spans during one …

中等
2261

含最多 K 个可整除元素的子数组

Count all distinct subarrays with at most k elements divisible by p using array scanning and hash lookup techniques effi…

中等
2265

统计值等于子树平均值的节点数

Given a binary tree, count nodes where the value equals the average of values in its subtree.

中等
2266

统计打字方案数

Calculate the total number of possible original texts from a pressed key sequence using state transition dynamic program…

中等
2270

分割数组的方案数

Count all valid ways to split a 0-indexed integer array into two non-empty parts using array plus prefix sum logic effic…

中等
2271

毯子覆盖的最多白色砖块数

Solve Maximum White Tiles Covered by a Carpet by sorting intervals, checking optimal carpet starts, and counting full pl…

中等
2274

不含特殊楼层的最大连续楼层数

Find the maximum sequence of consecutive floors without any special floors using array sorting techniques efficiently.

中等
2275

按位与结果大于零的最长组合

Find the largest group of integers in an array whose bitwise AND is greater than zero using array scanning and hash look…

中等
2279

装满石头的背包的最大数量

Maximize the number of bags filled to capacity by distributing additional rocks using a greedy approach.

中等
2280

表示一个折线图的最少线段数

Determine the fewest lines needed to accurately connect stock price points in a line chart using array and math reasonin…

中等
2284

最多单词数的发件人

Find the sender with the largest total word count by scanning messages and tallying counts using a hash table efficientl…

中等
2285

道路的最大总重要性

Assign unique values to cities to maximize the total importance of all roads using greedy selection based on city connec…

中等
2288

价格减免

Apply Discount to Prices involves updating a sentence by applying a percentage discount to price words, with precise for…

中等
2289

使数组按非递减顺序排列

Determine the minimum steps to make an array non-decreasing using linked-list pointer manipulation and monotonic stack t…

中等
2294

划分数组使最大差为 K

Find the minimum number of subsequences required such that the difference between the maximum and minimum value in each …

中等
2295

替换数组中的元素

Replace Elements in an Array involves applying a series of operations to replace values in an array with new ones based …

中等
2300

咒语和药水的成功对数

Count how many potions pair successfully with each spell using binary search over sorted potion strengths efficiently.

中等
2304

网格中的最小路径代价

Minimize the cost of a path in a grid while considering move costs for each step.

中等
2305

公平分发饼干

The problem focuses on fairly distributing cookies among children to minimize the maximum unfairness of the distribution…

中等
2310

个位数字为 K 的整数之和

Determine the minimum set of positive integers whose units digits match k and sum exactly to num using DP patterns.

中等
2311

小于等于 K 的最长二进制子序列

Find the longest subsequence in a binary string that forms a number less than or equal to a given integer k.

中等
2316

统计无向图中无法互相到达点对数

Calculate the total number of node pairs in an undirected graph that cannot reach each other using DFS, BFS, or Union Fi…

中等
2317

操作后的最大异或和

Maximize the bitwise XOR of an array after applying a special operation with non-negative integers multiple times.

中等
2320

统计放置房子的方式数

This problem asks you to calculate the number of ways to place houses along a street while preventing adjacent houses on…

中等
2326

螺旋矩阵 IV

In this problem, you need to generate a matrix filled with values from a linked list in a spiral order.

中等
2327

知道秘密的人数

Calculate how many people know a secret over n days using state transition dynamic programming and careful simulation of…

中等
2332

坐上公交的最晚时间

Find the latest time to catch a bus based on departure times, passenger arrivals, and capacity using binary search over …

中等
2333

最小差值平方和

Calculate the minimum sum of squared differences between two arrays using limited modifications and binary search techni…

中等
2336

无限集中的最小数字

Design a data structure to handle the smallest missing element in an infinite set, with the ability to add and remove el…

中等
2337

移动片段得到字符串

Determine if the pieces in start can be moved to form target using two-pointer scanning and strict left-right movement r…

中等
2342

数位和相等数对的最大和

Find the maximum sum of two numbers with equal digit sums in a given array of positive integers.

中等
2343

裁剪数字后查询第 K 小的数字

Solve the Query Kth Smallest Trimmed Number problem by efficiently trimming and sorting strings in an array to answer qu…

中等
2348

全 0 子数组的数目

Given an array of integers, count the subarrays that consist entirely of 0s.

中等
2349

设计数字容器系统

Learn to implement a Number Container System using hash tables and design techniques to efficiently track numbers and in…

中等
2352

相等行列对

Identify all pairs of rows and columns in a square matrix that contain identical elements in the same sequence efficient…

中等
2353

设计食物评分系统

Design a food rating system that tracks and updates ratings of foods, finding the highest rated items by cuisine.

中等
2358

分组的最大数量

Determine the maximum number of ordered non-empty student groups for a competition using grades array analysis and binar…

中等
2359

找到离给定两个节点最近的节点

Find the node that minimizes the maximum distance to two given nodes in a directed graph with one outgoing edge per node…

中等
2364

统计坏数对的数目

Count the number of bad pairs in an array where the difference between indices and values does not match.

中等
2365

任务调度器 II

Complete tasks in the optimal number of days by considering breaks and task type constraints.

中等
2368

受限条件下可到达节点的数目

In the 'Reachable Nodes With Restrictions' problem, find the maximum reachable nodes from node 0 in a tree while avoidin…

中等
2369

检查数组是否存在有效划分

This problem challenges you to determine if an array can be partitioned into valid subarrays using dynamic programming.

中等
2370

最长理想子序列

The Longest Ideal Subsequence problem involves finding the longest subsequence where each character has a difference of …

中等
2374

边积分最高的节点

Determine the node with the highest edge score in a graph using hash table aggregation and careful index tracking.

中等
2375

根据模式串构造最小数字

Construct the lexicographically smallest string that fits the increasing and decreasing conditions of a given pattern.

中等
2380

二进制字符串重新安排顺序需要的时间

Calculate the exact seconds required to convert all 01 pairs into 10 in a binary string using state transitions.

中等
2381

字母移位 II

Shift letters in a string using a sequence of range-based forward or backward operations efficiently with prefix sums.

中等
2384

最大回文数字

Form the largest palindromic number from a string of digits while maintaining a valid palindrome structure.

中等
2385

感染二叉树需要的总时间

The problem asks to calculate the number of minutes for an infection to spread across all nodes in a binary tree startin…

中等
2390

从字符串中移除星号

Remove all stars from a string by simulating the removal process using a stack to manage characters and stars efficientl…

中等
2391

收集垃圾的最少总时间

This problem asks you to find the minimum amount of time needed to collect all garbage in a city, focusing on array and …

中等
2396

严格回文的数字

Determine if a number is strictly palindromic in all bases from 2 to n minus 2 using two-pointer scanning and invariant …

中等
2397

被列覆盖的最多行数

Select exactly numSelect columns from a binary matrix to maximize rows where all ones are covered efficiently using back…

中等
2400

恰好移动 k 步到达某一位置的方法数目

Find the number of ways to reach a position after exactly k steps on an infinite number line using dynamic programming.

中等
2401

最长优雅子数组

Find the length of the longest nice subarray where the bitwise AND of all pairs of elements in the subarray is zero.

中等
2405

子字符串的最优划分

Given a string s, partition it into substrings with unique characters and return the minimum number of substrings.

中等
2406

将区间分为最少组数

Determine the minimum number of non-overlapping groups for a set of intervals using precise two-pointer scanning logic.

中等
2410

运动员和训练师的最大匹配数

Maximize the number of valid player-trainer matchings using two-pointer scanning and careful sorting strategy.

中等
2411

按位或最大的最小子数组长度

Find the smallest subarrays with the maximum bitwise OR for each starting index in an array.

中等
2414

最长的字母序连续子字符串的长度

Find the length of the longest continuous alphabetical substring from a given string of lowercase letters.

中等
2415

反转二叉树的奇数层

Reverse the node values at each odd level in a perfect binary tree, preserving the even levels.

中等
2419

按位与最大的最长子数组

Find the length of the longest subarray whose bitwise AND reaches the array's maximum value, combining array scanning wi…

中等
2420

找到所有好下标

Identify all indices in an array where the k-length prefix is non-increasing and the k-length suffix is non-decreasing.

中等
2424

最长上传前缀

Calculate the longest continuous uploaded prefix in a video stream efficiently using a mix of binary search and data str…

中等
2425

所有数对的异或和

Compute the overall bitwise XOR from all pairings between two arrays using efficient array and bit manipulation techniqu…

中等
2428

沙漏的最大总和

Calculate the maximum sum of an hourglass in a 2D matrix using array traversal and submatrix evaluation techniques effic…

中等
2429

最小异或

Minimize XOR problem asks for an integer that minimizes XOR with another, applying greedy choices for bit manipulation.

中等
2433

找出前缀异或的原始数组

Find the original array from a given prefix XOR array using bitwise manipulation techniques.

中等
2434

使用机器人打印字典序最小的字符串

Solve the problem of using a robot to print the lexicographically smallest string with stack-based state management.

中等
2438

二的幂数组中查询范围内的乘积

The Range Product Queries of Powers problem requires calculating the product of powers of 2 for a range of queries on a …

中等
2439

最小化数组中的最大值

Minimize Maximum of Array involves finding the smallest possible maximum value after applying a series of operations on …

中等
2442

反转之后不同整数的数目

This problem requires counting distinct integers after performing reverse operations on each integer in an array.

中等
2443

反转之后的数字和

Determine if a non-negative integer can be expressed as the sum of a number and its reverse using enumeration and math r…

中等
2447

最大公因数等于 K 的子数组数目

Count the number of subarrays with GCD equal to a given value k from a list of integers.

中等
2452

距离字典两次编辑以内的单词

Identify all words in queries that can match dictionary entries with at most two character changes efficiently using arr…

中等
2453

摧毁一系列目标

Find the minimum seed value to destroy the most targets on a number line, using array scanning and hash lookup.

中等
2456

最流行的视频创作者

Identify the most popular video creator by summing views and selecting their top-viewed video with array and hash patter…

中等
2457

美丽整数的最小增量

Find the minimum addition to a number such that its digits sum to a value less than or equal to a given target.

中等
2461

长度为 K 子数组中的最大和

Find the maximum sum of all distinct-element subarrays of length k using array scanning and hash lookup techniques.

中等
2462

雇佣 K 位工人的总代价

Optimize the total cost of hiring exactly k workers using a two-pointer approach with invariant tracking and priority qu…

中等
2466

统计构造好字符串的方案数

Count the number of ways to build good binary strings using dynamic programming with state transitions.

中等
2467

树上最大得分和路径

Solve the 'Most Profitable Path in a Tree' problem using graph traversal and depth-first search techniques to maximize A…

中等
2470

最小公倍数等于 K 的子数组数目

Find the number of subarrays in an array where the least common multiple (LCM) of the subarray equals a given integer k.

中等
2471

逐层排序二叉树所需的最少操作数目

Determine the minimum number of swaps to sort each level of a binary tree using level-wise traversal efficiently.

中等
2476

二叉搜索树最近节点查询

Solve the problem of finding closest nodes in a Binary Search Tree for multiple queries, efficiently handling each query…

中等
2477

到达首都的最少油耗

Calculate the minimum fuel needed for all city representatives to reach the capital using DFS on a tree graph efficientl…

中等
2482

行和列中一和零的差值

This problem requires computing a difference matrix based on the ones and zeros in each row and column of a binary matri…

中等
2483

商店的最少代价

Determine the earliest closing hour of a shop to minimize penalty using a string of customer visits and prefix sums.

中等
2486

追加字符以获得子序列

Determine the minimum characters to append to s so t becomes a subsequence using efficient two-pointer scanning techniqu…

中等
2487

从链表中移除节点

This problem requires removing nodes from a linked list when a larger node exists to their right, testing pointer manipu…

中等
2491

划分技能点相等的团队

Divide players into equal skill teams and return the sum of their chemistry, or -1 if impossible.

中等
2492

两个城市间路径的最小分数

Find the minimum distance in a path connecting two cities using graph traversal strategies efficiently.

中等
2497

图中最大星和

Find the maximum star sum in a graph with specific node values and edges, using greedy algorithms to select the optimal …

中等
2498

青蛙过河 II

Frog Jump II requires finding the minimal maximum jump length for a frog to traverse stones forward and backward efficie…

中等
2501

数组中最长的方波

Find the length of the longest subsequence where each element is a perfect square of its previous one.

中等
2502

设计内存分配器

Design a memory allocator that simulates allocation and deallocation of memory blocks.

中等
2507

使用质因数之和替换后可以取到的最小值

Replace a number with the sum of its prime factors until it stabilizes, and return the smallest value.

中等
2512

奖励最顶尖的 K 名学生

Calculate top K student scores by scanning reports and using hash tables for positive and negative word lookups efficien…

中等
2513

最小化两个数组中的最大值

Minimize the Maximum of Two Arrays requires finding the smallest possible maximum number across two arrays, using binary…

中等
2516

每种字符至少取 K 个

Find the minimum number of minutes needed to take at least k of each character from both ends of a string.

中等
2517

礼盒的最大甜蜜度

Maximize the tastiness of a candy basket by choosing k candies from a list of candy prices.

中等
2521

数组乘积中的不同质因数数目

Find the number of distinct prime factors in the product of an array of integers.

中等
2522

将字符串分割成值不超过 K 的子字符串

Determine the minimum number of substrings from a numeric string such that each substring value does not exceed k using …

中等
2523

范围内最接近的两个质数

Find the two closest prime numbers within a given range using efficient number theory techniques and gap comparisons.

中等
2526

找到数据流中的连续整数

Design a data stream checker to identify consecutive integers from a stream, focusing on handling state transitions effi…

中等
2527

查询数组异或美丽值

Find the xor-beauty of an array by XORing the effective values of all possible triplets of indices.

中等
2530

执行 K 次操作后的最大分数

Maximize your score by applying exactly k operations on an array using greedy selection and heap optimization techniques…

中等
2531

使字符串中不同字符的数目相等

Determine if a single swap can equalize distinct character counts between two strings using hash tables for tracking fre…

中等
2536

子矩阵元素加 1

Increment Submatrices by One focuses on efficiently updating submatrices using row-wise prefix sums in an n by n matrix.

中等
2537

统计好子数组的数目

Count the number of subarrays that contain at least k pairs of equal elements using array scanning and hash lookup.

中等
2541

使数组中所有元素相等的最小操作数 II

Calculate the minimum operations to make two integer arrays equal using greedy adjustments with modular checks efficient…

中等
2542

最大子序列的分数

Maximize the score of a subsequence by selecting indices based on nums1 and nums2, using a greedy approach and sorting.

中等
2545

根据第 K 场考试的分数排序

Sort a matrix of student scores by the kth exam efficiently using array manipulation and custom sorting techniques.

中等
2546

执行逐位运算使字符串相等

Determine if a binary string s can be transformed into target using repeated bitwise operations on paired indices effici…

中等
2550

猴子碰撞的方法数

Calculate the total number of monkey collisions on a convex polygon using math and recursion efficiently for large n.

中等
2554

从一个范围内选择最多整数 I

Determine the maximum count of integers from 1 to n avoiding banned numbers while keeping the sum under maxSum.

中等
2555

两个线段获得的最多奖品

Maximize the total prizes by choosing two segments of length k on a sorted line of prize positions efficiently using bin…

中等
2556

二进制矩阵中翻转最多一次使路径不连通

Determine if a single cell flip can disconnect a path from the top-left to bottom-right in a binary matrix efficiently u…

中等
2559

统计范围内的元音字符串数

Count the number of strings that start and end with a vowel in given ranges within an array of words.

中等
2560

打家劫舍 IV

House Robber IV requires calculating minimum maximum money the robber can take using state transition dynamic programmin…

中等
2563

统计公平数对的数目

Efficiently count all fair pairs in an array using sorting and binary search, focusing on the sum range between lower an…

中等
2564

子字符串异或查询

Solve the Substring XOR Queries problem using array scanning and hash lookup to efficiently handle multiple queries on b…

中等
2567

修改两个元素的最小分数

The problem asks for the minimum score after changing two elements of an array using a greedy approach.

中等
2568

最小无法得到的或值

Find the smallest positive integer that cannot be formed from any subsequence OR combination in the array.

中等
2571

将整数减少到零需要的最少操作数

Compute the minimum number of operations to reduce a positive integer to zero using additions or subtractions of powers …

中等
2572

无平方子集计数

Learn how to efficiently count square-free subsets using state transition dynamic programming with bitmask optimizations…

中等
2575

找出字符串的可整除数组

Calculate the divisibility array for a string by checking if prefixes are divisible by a given number.

中等
2576

求出最多标记下标

Maximize marked indices in an array by performing allowed operations, applying binary search to find the optimal count e…

中等
2579

统计染色格子数

The "Count Total Number of Colored Cells" problem requires deriving a formula to compute colored cells based on elapsed …

中等
2580

统计将重叠区间合并成组的方案数

Count Ways to Group Overlapping Ranges is a medium difficulty problem focused on array manipulation and sorting to count…

中等
2583

二叉树中的第 K 大层和

Find the kth largest level sum in a binary tree using level-order traversal and sorting.

中等
2587

重排数组以得到最大前缀分数

Maximize the number of positive prefix sums by rearranging an integer array using a greedy, order-focused strategy.

中等
2588

统计美丽子数组数目

Count the Number of Beautiful Subarrays is a Medium-level problem involving array scanning and hash table lookup to find…

中等
2592

最大化数组的伟大值

Maximize Greatness of an Array requires permuting numbers to exceed original values at most indices efficiently.

中等
2593

标记所有元素后数组的分数

The problem involves marking elements in an array and calculating the score based on adjacent elements.

中等
2594

修车的最少时间

Find the minimum time to repair all cars using mechanics with different ranks, applying binary search over possible time…

中等
2596

检查骑士巡视方案

Validate a knight's movement configuration on an n x n chessboard to check if it forms a valid Knight's Tour.

中等
2597

美丽子集的数目

Count all non-empty subsets of an array where no two numbers have an absolute difference equal to k, using array scannin…

中等
2598

执行操作后的最大 MEX

Find the smallest missing non-negative integer after repeated additions or subtractions of a given value in nums array e…

中等
2601

质数减法运算

Determine if it's possible to make the array strictly increasing using prime subtractions.

中等
2602

使数组元素全部相等的最少操作次数

Find the minimum number of operations to make all elements in an array equal for each query.

中等
2606

找到最大开销的子字符串

Find the Substring With Maximum Cost requires calculating substring values using a hash lookup for character costs, with…

中等
2607

使子数组元素和相等

Solve Make K-Subarray Sums Equal by grouping circular indices with gcd cycles and minimizing each group to its median.

中等
2610

转换二维数组

Learn how to convert an integer array into a 2D array with distinct rows using array scanning plus hash lookup efficient…

中等
2611

老鼠和奶酪

In 'Mice and Cheese', you must maximize the total reward of two mice eating cheese while respecting their preferences an…

中等
2615

等值距离和

In this problem, you calculate an array where each element is the sum of absolute differences of indices for equal value…

中等
2616

最小化数对的最大差值

Minimize the Maximum Difference of Pairs seeks to optimize the maximum pairwise difference in a set of index pairs from …

中等
2618

检查是否是类的对象实例

Implement a function to check if an object is an instance of a specific class or its superclass in JavaScript.

中等
2622

有时间限制的缓存

Implement a time-limited cache where keys expire after a given duration, with operations to set, get, and count active k…

中等
2623

记忆函数

This problem focuses on creating a memoized function that caches results to prevent repeated computation with identical …

中等
2624

蜗牛排序

Transform a 1D array into a 2D matrix following the snail traversal core interview pattern efficiently and safely.

中等
2625

扁平化嵌套数组

Flatten Deeply Nested Array involves transforming multi-dimensional arrays based on depth constraints, requiring a caref…

中等
2627

函数防抖

Create a debounced function that delays execution and cancels previous calls within a time window.

中等
2631

分组

Implementing the Group By core interview pattern efficiently sorts array elements into keyed groups based on a selector …

中等
2637

有时间限制的 Promise 对象

Implement a time-limited wrapper for any asynchronous function to enforce execution constraints and prevent overruns.

中等
2640

一个数组所有前缀的分数

Compute the score of each prefix in an array using conversion rules while tracking the maximum efficiently for prefix su…

中等
2641

二叉树的堂兄弟节点 II

Replace each node in a binary tree with the sum of all its cousins by carefully tracking depth and parent relationships.

中等
2645

构造有效字符串的最少插入数

Determine the minimum insertions required to transform a given string into repeated concatenations of 'abc' using dynami…

中等
2649

嵌套数组生成器

Implement a generator that performs inorder traversal on a multi-dimensional array of integers.

中等
2653

滑动子数组的美丽值

Compute the xth smallest negative number in each sliding subarray using array scanning and hash frequency tracking effic…

中等
2654

使数组所有元素变成 1 的最少操作次数

Find the minimum number of operations to transform every element of a positive integer array into 1 using gcd operations…

中等
2657

找到两个数组的前缀公共数组

This problem challenges you to find the prefix common array of two integer permutations, utilizing array scanning and ha…

中等
2658

网格图中鱼的最大数目

Maximize the number of fish that can be caught by performing DFS on an optimal starting point in a grid.

中等
2661

找出叠涂元素

Find the first index where a row or column is completely painted in a matrix based on an array of integers.

中等
2662

前往目标的最小代价

Find the minimum cost path between two points, using special roads or direct moves in a 2D space.

中等
2671

频率跟踪器

Design a data structure to track values and answer frequency-related queries efficiently using hash tables.

中等
2672

有相同颜色的相邻元素数目

Calculate the number of adjacent elements sharing the same color after sequentially updating an initially zeroed array u…

中等
2673

使二叉树所有路径值相等的最小代价

Minimize the cost increments required to equalize path costs in a binary tree from root to leaves.

中等
2679

矩阵中的和

Calculate the maximum score by repeatedly removing the largest elements from each row of a 2D matrix efficiently using s…

中等
2680

最大或值

Maximize the bitwise OR of an array by applying at most k multiplication operations on selected elements.

中等
2683

相邻值的按位异或

Determine if a binary array original exists that produces the given derived array using neighboring bitwise XOR logic.

中等
2684

矩阵中移动的最大次数

Maximize the number of moves in a grid starting from the first column using state transition dynamic programming.

中等
2685

统计完全连通分量的数量

Determine the number of complete connected components in an undirected graph using efficient traversal techniques and gr…

中等
2693

使用自定义上下文调用函数

Learn to implement a callPolyfill method that correctly sets a function's this context and passes arguments properly.

中等
2694

事件发射器

Design an EventEmitter class that can subscribe, emit, and unsubscribe events, mimicking patterns seen in Node.js or DOM…

中等
2698

求一个整数的惩罚数

Find the punishment number of a given integer using backtracking search with pruning.

中等
2705

精简对象

Compact Object requires removing all falsy values from an object or array recursively to produce a clean, minimal struct…

中等
2707

字符串中的额外字符

The problem asks for the minimum number of extra characters left after optimally breaking a string into substrings found…

中等
2708

一个小组的最大实力值

Maximize the strength of a student group by carefully selecting students based on their scores, using dynamic programmin…

中等
2711

对角线上不同值的数量差

Find the difference in the number of distinct diagonal values in a matrix, returning results in a new matrix.

中等
2712

使所有字符相等的最小成本

Find the minimum cost to make all characters of a binary string equal by performing two types of operations.

中等
2718

查询后矩阵的和

Calculate the total sum of a zero-filled n x n matrix after sequentially applying row and column update queries efficien…

中等
2721

并行执行异步函数

Solve the problem of executing asynchronous functions in parallel, handling resolve and reject scenarios effectively.

中等
2722

根据 ID 合并两个数组

Merge two arrays of objects by their id keys, resolving conflicts with arr2 values and sorting by id ascending.

中等
2730

找到最长的半重复子字符串

Find the length of the longest substring where at most one adjacent pair of digits repeats, using a sliding window appro…

中等
2731

移动机器人

Calculate total distances between robots moving on a number line while accounting for collisions using array plus braint…

中等
2734

执行子串操作后的字典序最小字符串

Given a string, perform operations to make it lexicographically smaller using a greedy approach with substring modificat…

中等
2735

收集巧克力

Calculate the minimum cost to collect all chocolate types using rotations and purchases in an array-based enumeration pa…

中等
2740

找出分区值

Find the minimum partition value by dividing a positive integer array into two subarrays using sorting for efficiency.

中等
2741

特别的排列

Count the number of special permutations for a given array using dynamic programming and bit manipulation.

中等
2745

构造最长的新字符串

Maximize the length of a string built from AA, BB, and AB without creating triple repeats using DP and greedy logic.

中等
2746

字符串连接删减字母

Solve the Decremental String Concatenation problem by applying dynamic programming to minimize string length after conca…

中等
2747

统计没有收到请求的服务器数目

Count Zero Request Servers finds the number of servers with zero requests during specific time intervals for a given set…

中等
2749

得到整数零需要执行的最少操作数

This problem challenges you to compute the minimum operations to reduce an integer to zero using bit manipulation and st…

中等
2750

将数组划分成若干好子数组的方式

Calculate the number of ways to partition a binary array into good subarrays using state transition dynamic programming …

中等
2761

和等于目标值的质数对

Find all prime number pairs that sum up to a given integer n using an efficient sieve-based array approach.

中等
2762

不间断子数组

Count all continuous subarrays efficiently using sliding window with running max-min state tracking for array consistenc…

中等
2766

重新放置石块

Relocate marbles to new positions in an array by simulating moves, and return sorted occupied positions.

中等
2767

将字符串分割为最少的美丽子字符串

Partition a binary string into the fewest beautiful substrings using state transition dynamic programming and careful su…

中等
2768

黑格子的数目

Calculate the number of black blocks in a grid given a list of black cell coordinates.

中等
2770

达到末尾下标所需的最大跳跃次数

Find the maximum number of jumps to reach the last index using state transition dynamic programming efficiently in array…

中等
2771

构造最长非递减子数组

Maximize the length of a non-decreasing subarray by optimally choosing elements from two arrays using dynamic programmin…

中等
2772

使数组中的所有元素都等于零

Determine if all elements in a given array can be reduced to zero using repeated k-length prefix operations efficiently.

中等
2779

数组的最大美丽值

Find the maximum beauty of an array by adjusting elements within a range using binary search and sliding window techniqu…

中等
2780

合法分割的最小下标

Find the minimum index to split an array such that both subarrays have the same dominant element.

中等
2785

将字符串中的元音字母排序

Sort Vowels in a String requires identifying vowels in a string and rearranging them in ascending order while keeping co…

中等
2786

访问数组中的位置使分数最大

Maximize your score by visiting positions in an array while handling penalties for parity changes efficiently with DP.

中等
2787

将一个数字表示成幂的和的方案数

Compute the number of ways to express an integer as a sum of unique powers using state transition dynamic programming ef…

中等
2789

合并后数组中的最大元素

This problem focuses on applying greedy choices and merging elements to find the largest element in an array.

中等
2799

统计完全子数组的数目

Count Complete Subarrays in an Array requires scanning the array while tracking elements to detect subarrays with all di…

中等
2800

包含三个字符串的最短字符串

Find the shortest string containing three given strings using a greedy approach while ensuring it is lexicographically s…

中等
2807

在链表中插入最大公约数

The problem involves inserting greatest common divisors between adjacent nodes in a linked list.

中等
2808

使循环数组所有元素相等的最少秒数

Find the minimum number of seconds to equalize a circular array using array scanning and hash lookup techniques.

中等
2811

判断是否能拆分数组

Determine whether an array can be fully split into single-element subarrays using a state transition dynamic programming…

中等
2812

找出最安全路径

Find the Safest Path in a Grid uses binary search and BFS to maximize path safeness from thieves in a grid.

中等
2816

翻倍以链表形式表示的数字

Double a number represented as a linked list by carefully managing node values and carries with pointer traversal techni…

中等
2817

限制条件下元素之间的最小绝对差

Find the minimum absolute difference between two array elements that are at least x indices apart using binary search.

中等
2825

循环增长使字符串子序列等于另一个字符串

Determine if str2 can be made a subsequence of str1 by incrementing characters cyclically using at most one operation.

中等
2826

将三个组排序

Determine the minimum removals to make an array of 1s, 2s, and 3s non-decreasing using dynamic programming transitions.

中等
2829

k-avoiding 数组的最小总和

Determine the minimum sum of a k-avoiding array by choosing distinct integers such that no pair sums to a given k.

中等
2830

销售利润最大化

Determine the maximum profit a salesman can earn by strategically selecting non-overlapping offers on consecutive houses…

中等
2831

找出最长等值子数组

Find the maximum length of an equal subarray after removing up to k elements using array scanning and hash-based index t…

中等
2834

找出美丽数组的最小和

Find the minimum possible sum of a beautiful array that satisfies the given conditions with the greedy approach.

中等
2840

判断通过操作能否让字符串相等 II

Check if two strings can be made equal using operations that swap characters with the same parity.

中等
2841

几乎唯一子数组的最大和

Find the maximum sum of subarrays that contain at least m distinct elements using array scanning and hash lookups effici…

中等
2844

生成特殊数字的最少操作

Minimize operations to make a number divisible by 25 by deleting digits. Use greedy choice and invariant validation.

中等
2845

统计趣味子数组的数目

Count all subarrays where the number of elements satisfying a modulo condition equals a target k using efficient prefix …

中等
2849

判断能否在给定时间到达单元格

The problem asks if a target cell can be reached from a starting position within a given time on a 2D grid.

中等
2850

将石头分散到网格图的最少移动次数

Solve the problem of distributing 9 stones across a 3x3 grid with minimal moves using state transition dynamic programmi…

中等
2856

删除数对后的最小数组长度

This problem involves minimizing the length of a sorted array by repeatedly removing adjacent pairs of equal elements.

中等
2857

统计距离为 k 的点对

Solve the problem of counting pairs of points with distance k using array scanning and hash table techniques.

中等
2860

让所有学生保持开心的分组方法数

The Happy Students problem asks how many ways a teacher can select a group of students so everyone is happy, based on ce…

中等
2861

最大合金数

Determine the maximum number of alloys possible using limited metal stock and budget, leveraging binary search efficient…

中等
2865

美丽塔 I

Solve Beautiful Towers I by testing each peak and enforcing mountain limits with monotonic stack style height propagatio…

中等
2866

美丽塔 II

Maximize tower configurations with the stack-based approach while ensuring mountain-like patterns in this medium difficu…

中等
2870

使数组为空的最少操作次数

Minimize the number of operations to make an array empty by leveraging array scanning and hash lookup.

中等
2871

将数组分割成最多数目的子数组

Maximize the number of subarrays in an array while ensuring each subarray's bitwise AND meets the minimum score requirem…

中等
2874

有序三元组中的最大值 II

Solve Maximum Value of an Ordered Triplet II in linear time by tracking the best left difference and right multiplier.

中等
2875

无限数组的最短子数组

Find the shortest subarray in an infinite array that sums to a given target using array scanning and hash lookup.

中等
2895

最小处理时间

Determine the minimum total processing time by optimally assigning tasks to multiple processors using a greedy approach.

中等
2896

执行操作使两个字符串相等

Apply Operations to Make Two Strings Equal involves transforming binary strings with a cost-based dynamic programming ap…

中等
2901

最长相邻不相等子序列 II

Find the longest subsequence of indices such that the corresponding strings have a valid Hamming distance and group cons…

中等
2904

最短且字典序最小的美丽子字符串

Find the shortest beautiful substring in a binary string and return the lexicographically smallest option efficiently us…

中等
2905

找出满足差值条件的下标 II

Locate two indices in an array where both index and value differences meet specified thresholds using precise scanning t…

中等
2906

构造乘积矩阵

Solve the "Construct Product Matrix" problem by calculating the product of elements in 2D matrices without division.

中等
2909

元素和最小的山形三元组 II

Find the minimum sum of a valid mountain triplet in an integer array, or return -1 if no valid triplet exists.

中等
2910

合法分组的最少组数

The problem involves sorting balls into boxes while minimizing the number of boxes, adhering to size constraints.

中等
2914

使二进制字符串变美丽的最少修改次数

This problem involves determining the minimum number of changes to make a binary string beautiful using string-driven st…

中等
2915

和为目标值的最长子序列的长度

Find the length of the longest subsequence in an array that sums to a target value, using dynamic programming.

中等
2918

数组的最小相等和

Find the minimum sum where two arrays become equal after replacing all zeros with positive integers using a greedy strat…

中等
2919

使数组变美的最小增量运算数

Optimize the number of increment operations to make an array beautiful by ensuring subarrays of size 3 or more meet the …

中等
2924

找到冠军 II

Identify the strongest team in a tournament DAG using graph-driven logic, ensuring correct handling of in-degree zero ch…

中等
2925

在树上执行操作以后得到的最大分数

Solve Maximum Score After Applying Operations on a Tree by turning healthy-path constraints into subtree DP and forced-v…

中等
2929

给小朋友们分糖果 II

Determine how to distribute n candies among 3 children without exceeding a limit on individual candies.

中等
2930

重新排列后包含指定子字符串的字符串数目

Calculate how many strings of length n can be rearranged to contain "leet" using dynamic programming and combinatorics.

中等
2933

高访问员工

Identify employees with high system access within one-hour periods based on access logs.

中等
2934

最大化数组末位元素的最少操作次数

Minimize the number of operations needed to maximize the last elements of two arrays with specific swaps.

中等
2938

区分黑球与白球

Solve the "Separate Black and White Balls" problem by swapping adjacent balls to group all black balls to the right with…

中等
2939

最大异或乘积

Find the maximum value of (a XOR x) * (b XOR x) using greedy bitwise choices and invariant validation.

中等
2943

最大化网格图中正方形空洞的面积

Learn how to maximize the area of a square-shaped hole by selectively removing horizontal and vertical bars efficiently …

中等
2944

购买水果需要的最少金币数

Calculate the minimum coins to buy fruits using state transition dynamic programming while handling rewards and purchase…

中等
2947

统计美丽子字符串 I

Given a string and a value k, count the number of beautiful substrings where vowels * consonants % k == 0.

中等
2948

交换得到字典序最小的数组

Solve the problem of making an array lexicographically smallest through element swaps under a limit constraint.

中等
2952

需要添加的硬币的最小数量

Determine the minimum number of coins to add so all values up to target are obtainable using a greedy sum approach.

中等
2957

消除相邻近似相等字符

Minimize operations to remove adjacent almost-equal characters using dynamic programming and greedy methods.

中等
2958

最多 K 个重复元素的最长子数组

Find the maximum length subarray where each number appears at most k times using array scanning and hash lookups.

中等
2961

双模幂运算

Solve the Double Modular Exponentiation problem by applying array manipulation and modular arithmetic to find good indic…

中等
2962

统计最大元素出现至少 K 次的子数组

Find the number of subarrays where the maximum element appears at least k times using a sliding window approach.

中等
2966

划分数组并满足最大差限制

Divide an array into subarrays with a maximum element difference under a given threshold using a greedy approach.

中等
2967

使数组成为等数数组的最小代价

Determine the minimum cost to convert an integer array into a palindromic array using allowed element modifications effi…

中等
2971

找到最大周长的多边形

Determine the largest perimeter polygon from a set of side lengths using a greedy approach with invariant validation che…

中等
2975

移除栅栏得到的正方形田地的最大面积

This problem challenges you to calculate the largest square area possible by removing fences from a given rectangular fi…

中等
2976

转换字符串的最小成本 I

This problem asks to calculate the minimum cost to convert a string from source to target using specific character trans…

中等
2981

找出出现至少三次的最长特殊子字符串 I

Find the longest special substring in a string that appears at least three times, or return -1 if no such substring exis…

中等
2982

找出出现至少三次的最长特殊子字符串 II

Find the longest special substring that occurs at least three times in a given string using binary search and hash table…

中等
2997

使数组异或和等于 K 的最少操作次数

Find the minimum number of operations to make the XOR of an array equal to a given value k by modifying array elements.

中等
2998

使 X 和 Y 相等的最少操作次数

Determine the minimum operations to make two integers equal using increment, decrement, and division efficiently with DP…

中等
3001

捕获黑皇后需要的最少移动次数

Determine the fewest moves to capture the black queen using only white pieces with careful position analysis.

中等
3002

移除后集合的最多元素数

Maximize a set size by strategically removing half of elements from two arrays using hash lookups and array scanning.

中等
3006

找出数组中的美丽下标 I

Identify all beautiful indices where substring a appears and a nearby substring b exists within distance k efficiently.

中等
3007

价值和小于等于 K 的最大数字

Find the greatest number whose accumulated price, based on binary set bit positions, is less than or equal to k.

中等
3011

判断一个数组是否可以变为有序

Determine if a given array can be sorted using adjacent swaps restricted by equal set bits in binary representation.

中等
3012

通过操作使数组长度最小

Minimize the length of an integer array through a series of operations, using a greedy approach with modular arithmetic.

中等
3015

按距离统计房屋对数目 I

Determine the number of house pairs at each street distance using graph traversal and breadth-first search efficiently.

中等
3016

输入单词需要的最少按键次数 II

Given a word, find the minimum number of pushes to type it on a remapped keypad using a greedy approach.

中等
3020

子集中元素的最大数量

This problem asks you to find the maximum subset size where each number in the subset follows a specific pattern with ha…

中等
3021

Alice 和 Bob 玩鲜花游戏

Alice and Bob play a turn-based game on a circular field with flowers, where players must choose pairs that satisfy pari…

中等
3025

人员站位的方案数 I

Calculate how many valid pairs of points can be formed on a 2D plane using array and math enumeration techniques efficie…

中等
3026

最大好子数组和

Find the maximum sum of any subarray where the first and last elements differ by exactly k using efficient array scannin…

中等
3029

将单词恢复初始状态所需的最短时间 I

Determine the minimum seconds to revert a string to its original state using repeated prefix shifts of length k efficien…

中等
3030

找出网格的区域平均强度

Find the Grid of Region Average requires identifying regions in a matrix where pixel differences are below a threshold, …

中等
3034

匹配模式数组的子数组数目 I

Count all subarrays in a given integer array that strictly follow a defined numeric pattern using rolling hash checks ef…

中等
3035

回文字符串的最大数量

The problem focuses on maximizing the number of palindromes that can be formed from a given list of words through specif…

中等
3039

进行操作使字符串为空

Learn how to systematically apply operations on a string using array scanning and hash lookups to reduce it efficiently.

中等
3040

相同分数的最大操作数目 II

This problem asks to maximize operations on an integer array where all deletions produce the same score using dynamic pr…

中等
3043

最长公共前缀的长度

Determine the length of the longest common prefix between two integer arrays using array scanning and hash lookup effici…

中等
3044

出现频率最高的质数

Find the most frequent prime over 10 from numbers generated by scanning a 2D matrix in all straight directions efficient…

中等
3047

求交集区域内的最大正方形面积

Find the largest square area that can fit inside the intersection of two or more rectangles in a 2D plane.

中等
3048

标记所有下标的最早秒数 I

The problem asks to determine the earliest second to mark all indices in an array using a set of operations.

中等
3066

超过阈值的最少操作数 II

Calculate the fewest operations to make every array element exceed a threshold using a min-heap simulation strategy effi…

中等
3067

在带权树网络中统计可连接服务器对数目

This problem involves counting pairs of connectable servers in a weighted tree network using binary-tree traversal and D…

中等
3070

元素和小于等于 k 的子矩阵的数目

Count all submatrices including the top-left element with sum less than k using array and matrix prefix sum strategies.

中等
3071

在矩阵上写出字母 Y 所需的最少操作次数

Find the minimum number of operations to write the letter Y on a grid by altering cell values.

中等
3075

幸福值最大化的选择方案

Maximize the happiness of selected children by choosing the k happiest ones and applying greedy strategies to minimize l…

中等
3076

数组中的最短非公共子字符串

Find the shortest substring for each string in an array that does not appear in any other string efficiently using hashi…

中等
3080

执行操作标记数组中的元素

Efficiently mark elements in an array based on queries using scanning plus hash lookup to track marked indices and compu…

中等
3081

替换字符串中的问号使分数最小

Minimize the cost of a string with '?' characters by replacing them with letters in lexicographical order while minimizi…

中等
3084

统计以给定字符开头和结尾的子字符串总数

Given a string and a character, find the total number of substrings that start and end with that character.

中等
3085

成为 K 特殊字符串需要删除的最少字符数

Minimize deletions to make a string k-special by adjusting character frequencies.

中等
3091

执行操作使数据元素之和大于等于 K

Given an array nums, find the minimum number of operations to make the sum of elements greater than or equal to k.

中等
3092

最高频率的 ID

Track the most frequent ID after each update in a dynamic collection of IDs with changing frequencies.

中等
3096

得到更多分数的最少关卡数目

Determine the minimum number of levels Alice must play in a binary game array to secure more points than Bob using prefi…

中等
3097

或值至少为 K 的最短子数组 II

Find the length of the shortest subarray where the bitwise OR of all its elements is at least a given value.

中等
3100

换水问题 II

Compute the maximum number of water bottles you can drink by simulating exchanges with step-by-step math logic.

中等
3101

交替子数组计数

Count all alternating subarrays in a binary array efficiently using array patterns and simple mathematical reasoning.

中等
3106

满足距离约束且字典序最小的字符串

Minimize a string lexicographically using a series of operations constrained by a given integer k.

中等
3107

使数组中位数等于 K 的最少操作数

The problem involves minimizing operations to make the median of an array equal to a given value k using a greedy approa…

中等
3111

覆盖所有点的最少矩形数目

Find the minimum number of rectangles needed to cover all points, given constraints on width and position.

中等
3112

访问消失节点的最少时间

Determine the minimum time to visit each node in a disappearing-node graph using arrays, graphs, and priority queues eff…

中等
3115

质数的最大距离

Calculate the largest index gap between prime numbers in an array using array traversal and number theory insights effic…

中等
3121

统计特殊字母的数量 II

Count the Number of Special Characters II is a medium difficulty string and hash table problem that involves identifying…

中等
3122

使矩阵满足条件的最少操作次数

This problem asks to find the minimum number of operations on a 2D grid using state transition dynamic programming effic…

中等
3128

直角三角形

Count all possible right triangles in a 2D boolean grid using array scanning and hash lookup for efficiency.

中等
3129

找出所有稳定的二进制数组 I

Find all stable binary arrays of a given number of 0's, 1's, and limit using dynamic programming and state transitions.

中等
3132

找出与数组相加的整数 II

Given two arrays nums1 and nums2, determine the integer added to nums1 to make it equal to nums2 after removing two elem…

中等
3133

数组最后一个元素的最小值

Construct an array where elements are greater than the previous one, and the bitwise AND of all elements equals a given …

中等
3137

K 周期字符串需要的最少操作次数

The problem requires calculating the minimum number of operations to make a string k-periodic using specific substring r…

中等
3138

同位字符串连接的最小长度

The problem asks to find the minimum length of a string t such that s is a concatenation of anagrams of t.

中等
3143

正方形中的最多点数

Find the maximum number of points inside a valid square centered at the origin using a scanning and hashing approach.

中等
3144

分割字符频率相等的最少子字符串

Partition a string into substrings with equal character frequencies using dynamic programming and state transitions.

中等
3147

从魔法师身上吸取的最大能量

Maximize your energy by strategically jumping through magicians using array and prefix sum techniques for optimal path c…

中等
3148

矩阵中的最大得分

Maximize the score in a grid by making moves to the bottom or right, using state transition dynamic programming.

中等
3152

特殊数组 II

Determine whether each subarray meets the special condition of alternating parity for all adjacent elements efficiently …

中等
3153

所有数对中数位差之和

Sum of Digit Differences of All Pairs is a problem that involves counting digit differences in pairs from an array of in…

中等
3159

查询数组中元素的出现位置

Determine the position of each requested occurrence of x in nums using a hash table and efficient array scanning.

中等
3160

所有球里面不同颜色的数目

Efficiently track colors on balls using array scanning and hash lookup to return the count of distinct colors after each…

中等
3163

压缩字符串 III

Compress a string by repeatedly taking maximal same-character prefixes, following a string-driven solution strategy effi…

中等
3164

优质数对的总数 II

Calculate total good pairs by scanning two arrays and using hash lookup to match divisible elements efficiently with k.

中等
3169

无需开会的工作日

Count Days Without Meetings is a problem where you need to count days without scheduled meetings in a given work period.

中等
3170

删除星号以后字典序最小的字符串

Find the lexicographically smallest string by removing stars using stack-based state management and careful character se…

中等
3175

找到连续赢 K 场比赛的第一位玩家

Determine which player first wins k consecutive games using array simulation logic to track ongoing victories efficientl…

中等
3176

求出最长好子序列 I

Find the maximum length of a good subsequence by scanning arrays and using hash lookups for value remapping efficiently.

中等
3179

K 秒后第 N 个元素的值

Solve for the N-th value after K seconds by simulating array updates and using prefix sum techniques.

中等
3180

执行操作可获得的最大总奖励 I

Optimize the total reward by choosing operations on array indices using state transition dynamic programming techniques …

中等
3185

构成整天的下标对数目 II

Count the number of valid pairs of hours that form a complete day by checking if their sum is a multiple of 24.

中等
3186

施咒的最大总伤害

Calculate the maximum total damage by selectively casting spells while avoiding adjacent power conflicts using array sca…

中等
3191

使二进制数组全部等于 1 的最少操作次数 I

Find the minimum number of operations to make all elements of a binary array equal to one using sliding window and state…

中等
3192

使二进制数组全部等于 1 的最少操作次数 II

Solve the Minimum Operations to Make Binary Array Elements Equal to One II using state transition dynamic programming ef…

中等
3195

包含所有 1 的最小矩形面积 I

Find the smallest rectangle to cover all 1's in a 2D binary matrix, focusing on array and matrix handling.

中等
3196

最大化子数组的总成本

Maximize the total cost of alternating subarrays using dynamic programming to efficiently split an array into optimal su…

中等
3201

找出有效子序列的最大长度 I

Find the longest valid subsequence in an array of integers using dynamic programming to handle different patterns of seq…

中等
3202

找出有效子序列的最大长度 II

Determine the maximum length of a valid subsequence using state transition dynamic programming with careful modulo const…

中等
3207

与敌人战斗后的最大分数

Solve the "Maximum Points After Enemy Battles" problem by maximizing points through greedy choices with energy validatio…

中等
3208

交替组 II

Solve the problem of counting alternating groups in a circle of tiles using a sliding window approach.

中等
3211

生成不含相邻零的二进制字符串

Generate all binary strings of length n without adjacent zeros using backtracking search with pruning for efficient enum…

中等
3212

统计 X 和 Y 频数相等的子矩阵数量

Count the number of submatrices with equal frequency of 'X' and 'Y' in a 2D character grid.

中等
3217

从链表中移除在数组中存在的节点

Remove nodes from a linked list if their values exist in a given array.

中等
3218

切蛋糕的最小总开销 I

In this problem, you need to minimize the cost of cutting a cake into 1x1 pieces using vertical and horizontal cuts.

中等
3223

操作后字符串的最短长度

Find the minimum length of a string after performing operations based on character frequency.

中等
3224

使差值相等的最少数组改动次数

Minimize changes to make array differences equal by replacing elements within a given range.

中等
3227

字符串元音游戏

Solve the Vowels Game in a String using optimal moves and string analysis to predict the winner efficiently and accurate…

中等
3228

将 1 移动到末尾的最大操作次数

This problem requires finding the maximum number of operations to move ones to the end of a binary string.

中等
3233

统计不是特殊数字的数字数量

Count the numbers between two integers that are not special, where special numbers are squares of primes.

中等
3234

统计 1 显著的字符串的数量

Count the number of substrings in a binary string with dominant ones, using a sliding window approach with state updates…

中等
3239

最少翻转次数使二进制矩阵回文 I

Find the minimum flips to make a binary grid palindromic by scanning with two pointers and tracking symmetry efficiently…

中等
3240

最少翻转次数使二进制矩阵回文 II

The problem asks to flip cells in a binary grid to make its rows and columns palindromic using the minimum number of fli…

中等
3243

新增道路查询后的最短距离 I

Solve shortest paths dynamically in a growing graph using BFS, updating distances efficiently after each road addition q…

中等
3249

统计好节点的数目

Determine how many nodes in a binary tree have all child subtrees of equal size using DFS traversal efficiently.

中等
3254

长度为 K 的子数组的能量值 I

Given an array, find the power of all subarrays of size k using a sliding window approach.

中等
3255

长度为 K 的子数组的能量值 II

Compute the power of all k-size subarrays in an array using sliding window with running state updates efficiently.

中等
3259

超级饮料的最大强化能量

Maximize energy boost from two drinks with a state transition dynamic programming approach.

中等
3265

统计近似相等数对 I

Count Almost Equal Pairs I involves finding pairs of elements that can be made equal by swapping at most one digit.

中等
3271

哈希分割字符串

Hash Divided String requires splitting a string into equal parts and combining character values modulo 26 to form a new …

中等
3275

第 K 近障碍物查询

Solve the K-th nearest obstacle query problem using array and heap (priority queue) techniques to find distances efficie…

中等
3281

范围内整数的最大得分

Maximize Score of Numbers in Ranges asks to find the maximum score by selecting integers within given intervals with a f…

中等
3282

到达数组末尾的最大得分

Calculate the maximum score to reach the end of an array using greedy jumps based on array values and distances.

中等
3286

穿越网格图的安全路径

Determine if you can safely traverse a binary grid from top-left to bottom-right using limited health points.

中等
3290

最高乘法得分

The problem requires selecting four indices from an array to maximize a dynamic score with a transition approach.

中等
3291

形成目标字符串需要的最少字符串数 I

Use dynamic programming to split target into the fewest prefixes that match any word prefix, while ruling out dead posit…

中等
3295

举报垃圾信息

Determine if a message contains at least two banned words using array scanning and hash lookup.

中等
3296

移山所需的最少秒数

Determine the minimum seconds required to reduce a mountain to zero height using simultaneous workers efficiently.

中等
3297

统计重新排列后包含另一个字符串的子字符串数目 I

Count the number of valid substrings in word1 that can be rearranged to contain word2 as a prefix.

中等
3301

高度互不相同的最大塔高和

Assign heights to towers ensuring each height is unique and the total sum is maximized using greedy sorting techniques.

中等
3302

字典序最小的合法序列

Determine the lexicographically smallest valid index sequence by using state transition dynamic programming over word1 a…

中等
3305

元音辅音字符串计数 I

Count all substrings containing every vowel and exactly k consonants using a sliding window and hash map state tracking.

中等
3306

元音辅音字符串计数 II

Count the number of substrings containing all vowels and exactly k consonants using a sliding window technique.

中等
3309

连接二进制表示可形成的最大数值

Determine the largest number achievable by reordering three integers and concatenating their binary forms efficiently.

中等
3310

移除可疑的方法

Remove suspicious methods in a project that are invoked directly or indirectly from a buggy method using graph traversal…

中等
3315

构造最小位运算数组 II

Learn to build the minimum array matching a bitwise OR pattern for each prime in nums, focusing on binary optimization.

中等
3316

从原字符串里进行删除操作的最多次数

Determine the maximum number of characters you can remove from source while keeping pattern as a subsequence using array…

中等
3319

第 K 大的完美二叉子树的大小

Find the size of the kth largest perfect subtree in a binary tree using tree traversal and state tracking.

中等
3324

出现在屏幕上的字符串序列

Simulate Alice typing a target string with a special keyboard that appends letters one by one. Solve using string simula…

中等
3325

字符至少出现 K 次的子字符串 I

Calculate the total number of substrings where at least one character repeats k times using a sliding window efficiently…

中等
3326

使数组非递减的最少除法操作次数

Determine the minimum number of division operations to make an array non-decreasing using a greedy and invariant-based s…

中等
3331

修改后子树的大小

Calculate the sizes of all subtrees after simultaneous parent changes using array scanning and hash-based counting effic…

中等
3332

旅客可以得到的最多点数

Calculate the maximum points a tourist can earn by choosing optimal city moves over k days using state transition DP.

中等
3334

数组的最大因子得分

Calculate the maximum factor score of an integer array by optionally removing one element using LCM and GCD computations…

中等
3335

字符串转换后的长度 I

Calculate the total number of characters in a string after repeated transformations using dynamic programming and freque…

中等
3341

到达最后一个房间的最少时间 I

Find Minimum Time to Reach Last Room I challenges you to determine the minimum time to travel in a dungeon with a grid l…

中等
3342

到达最后一个房间的最少时间 II

Calculate the minimum time to reach the last room in a grid with alternating move times using array and graph patterns.

中等
3346

执行操作后元素的最高频率 I

Maximize the frequency of an element in an array after performing a series of operations to find the best possible resul…

中等
3350

检测相邻递增子数组 II

Find the largest k where two adjacent strictly increasing subarrays of length k exist using binary search techniques.

中等
3355

零数组变换 I

Transform the given integer array into a zero array using range operations, focusing on prefix sum optimization and care…

中等
3356

零数组变换 II

Zero Array Transformation II requires determining the minimum query sequence to convert all array elements to zero using…

中等
3361

两个字符串的切换距离

Find the minimum cost of transforming one string into another, considering operations between characters.

中等
3362

零数组变换 III

Zero Array Transformation III requires removing the minimum number of queries to make all elements zero using greedy val…

中等
3365

重排子字符串以形成目标字符串

Determine if s can be split into k equal substrings and rearranged to match t using a hash table for frequency tracking.

中等
3366

最小数组和

Solve the Minimum Array Sum problem using dynamic programming by tracking states and operations to minimize the sum of a…

中等
3371

识别数组中的最大异常值

Identify the largest outlier in an integer array using scanning and hash lookup for efficient detection and validation.

中等
3372

连接两棵树后最大目标节点数目 I

Maximize the number of target nodes after connecting two trees using binary tree traversal and state tracking.

中等
3376

破解锁的最少时间 I

Solve the Minimum Time to Break Locks I problem using state transition dynamic programming to minimize the time to break…

中等
3377

使两个整数相等的数位操作

Transform n into m using allowed digit operations without creating primes, applying math and graph strategies efficientl…

中等
3380

用点构造面积最大的矩形 I

Find the maximum area of a rectangle formed by given points on a plane with unique coordinates.

中等
3381

长度可被 K 整除的子数组的最大元素和

Find the maximum sum of a subarray where the length of the subarray is divisible by k.

中等
3387

两天自由外汇交易后的最大货币数

Compute the maximum currency amount after two days using graph traversal and depth-first search for optimal conversions.

中等
3388

统计数组中的美丽分割

Learn to count all valid beautiful splits in an array using state transition dynamic programming efficiently and accurat…

中等
3393

统计异或值为给定值的路径数目

Count the number of paths in a grid where the XOR of all values along the path equals a given number.

中等
3394

判断网格图能否被切割成块

Determine if an n x n grid can be divided with two horizontal or vertical cuts using rectangle ranges efficiently.

中等
3397

执行操作后不同元素的最大数量

Maximize distinct elements in an array by performing at most one operation on each element.

中等
3403

从盒子中找出字典序最大的字符串 I

This problem involves finding the lexicographically largest string from a given word using a two-pointer approach.

中等
3404

统计特殊子序列的数目

Count the number of special subsequences in an array of positive integers, focusing on efficient array scanning and hash…

中等
3408

设计任务管理器

Design a Task Manager that can efficiently handle task management operations such as adding, editing, executing, and rem…

中等
3409

最长相邻绝对差递减子序列

Find the length of the longest subsequence with non-increasing absolute adjacent differences.

中等
3412

计算字符串的镜像分数

Calculate the mirror score of a string using stack-based state management for matching letters efficiently and accuratel…

中等
3413

收集连续 K 个袋子可以获得的最多硬币数量

Solve the problem of maximizing coins from selecting k consecutive bags, using binary search and sliding window techniqu…

中等
3418

机器人可以获得的最大金币数

Find the maximum amount of money a robot can collect while neutralizing robbers on its path in a grid.

中等
3419

图的最大边权的最小值

Minimize the maximum edge weight in a graph after removing certain edges while ensuring node reachability.

中等
3424

将数组变相同的最小代价

Minimize cost to make arrays identical by performing operations with given constraints and a greedy strategy.

中等
3428

最多 K 个元素的子序列的最值之和

Find the sum of the maximum and minimum elements of subsequences with at most k elements, using dynamic programming.

中等
3429

粉刷房子 IV

Solve the Paint House IV problem using state transition dynamic programming to minimize the painting costs while adherin…

中等
3433

统计用户被提及情况

Calculate how many times each user is mentioned across MESSAGE events, accounting for offline and online statuses effici…

中等
3434

子数组操作后的最大频率

Determine the maximum frequency of a target value k after applying one subarray addition operation efficiently using arr…

中等
3439

重新安排会议得到最多空余时间 I

Maximize free time by rescheduling up to k non-overlapping meetings within a fixed event using sliding window updates.

中等
3440

重新安排会议得到最多空余时间 II

Maximize free time by rescheduling at most one meeting using a greedy choice with invariant validation approach for arra…

中等
3443

K 次修改后的最大曼哈顿距离

Solve Maximum Manhattan Distance After K Changes by scanning prefixes and testing the four diagonal target pairs with li…

中等
3446

按对角线进行矩阵排序

Sort Matrix by Diagonals groups cells by diagonal, then sorts bottom-left diagonals descending and top-right diagonals a…

中等
3447

将元素分配给有约束条件的组

Assign elements to groups by size constraints with a sieve-like approach to find suitable element matches efficiently.

中等
3453

分割正方形 I

Find the minimum y-coordinate of a horizontal line that balances the areas of squares above and below it.

中等
3457

吃披萨

Maximize the total weight gained by optimally eating pizzas in groups of four using greedy selection and invariant valid…

中等
3458

选择 K 个互不重叠的特殊子字符串

Determine if k non-overlapping special substrings exist in a string using dynamic programming and careful substring trac…

中等
3462

提取至多 K 个元素的最大总和

Find the maximum sum by selecting at most k elements from a 2D matrix respecting per-row limits using a greedy strategy.

中等
3468

可行数组的数目

Find the number of possible arrays by leveraging bounds and math in this array-based problem.

中等
3469

移除所有数组元素的最小代价

Find the minimum cost to remove all elements from the array with dynamic programming.

中等
3472

至多 K 次操作后的最长回文子序列

Find the longest palindromic subsequence of a string after performing at most k operations to adjust letters.

中等
3473

长度至少为 M 的 K 个子数组之和

Maximize the sum of k non-overlapping subarrays of at least length m using dynamic programming and prefix sums efficient…

中等
3478

选出和最大的 K 个元素

Choose K Elements With Maximum Sum involves sorting and selecting elements based on a specific rule, applying array plus…

中等
3479

水果成篮 III

Fruits Into Baskets III requires placing fruits into baskets efficiently using binary search over the answer space for c…

中等
3484

设计电子表格

Design a spreadsheet that supports setting, retrieving, and resetting values, with the ability to handle formulas refere…

中等
3488

距离最小相等元素查询

Find the nearest index with the same value for each query using array scanning combined with hash lookups efficiently.

中等
3493

属性图

Find the number of connected components in an undirected graph formed by properties arrays, using array scanning and has…

中等
3494

酿造药水需要的最少总时间

This problem involves calculating the minimum time required for wizards to brew potions based on their skills and mana u…

中等
3499

操作后最大活跃区段数 I

Maximize the number of active sections in a binary string by performing at most one trade operation.

中等
3503

子字符串连接后的最长回文串 I

Compute the maximum palindrome length by concatenating substrings from two strings using state transition dynamic progra…

中等
3508

设计路由器

Efficiently design a Router class to manage network packets with memory limits using array scanning and hash lookups.

中等
3513

不同 XOR 三元组的数目 I

Calculate all unique XOR triplet values in a permutation array using array traversal and bit manipulation techniques eff…

中等
3514

不同 XOR 三元组的数目 II

Count all unique XOR results from triplets in an integer array using array traversal and bit manipulation techniques eff…

中等
3517

最小回文排列 I

Build the smallest palindrome by sorting the left half counts and mirroring them around the optional middle character.

中等
3522

执行指令后的得分

Simulate a series of add and jump instructions on arrays to compute the final score efficiently using array scanning and…

中等
3523

非递减数组的最大长度

Determine the maximum size of a non-decreasing array by replacing subarrays with their maximum values efficiently.

中等
3524

求出数组的 X 值 I

Determine the x-value of an array using state transition dynamic programming to count valid prefix-suffix operations eff…

中等
3527

找到最常见的回答

Find the most common survey response after eliminating duplicates within each day, using array scanning and hash lookups…

中等
3528

单位转换 I

Solve the unit conversion problem by using graph traversal to compute equivalent unit amounts.

中等
3529

统计水平子串和垂直子串重叠格子的数目

Efficiently count grid cells appearing in both horizontal and vertical occurrences of a given string pattern using array…

中等
3531

统计被覆盖的建筑

Determine how many buildings in an n x n city are completely surrounded using array scanning and hash lookup efficiently…

中等
3532

针对图的路径存在性查询 I

Determine if paths exist between nodes using array scanning and hash lookups for efficient component checks in graphs.

中等
3537

填充特殊网格

Fill a Special Grid uses recursive divide-and-conquer to populate a 2^n x 2^n matrix with sequential integers uniquely i…

中等
3542

将所有元素变为 0 的最少操作次数

Calculate the fewest operations to turn all numbers in an array to zero using subarray minimum elimination strategy.

中等
3543

K 条边路径的最大边权和

Determine the maximum sum of edge weights for a k-edge path in a DAG using state transition dynamic programming efficien…

中等
3546

等和矩阵分割 I

Determine if an m x n matrix grid can be split into two non-empty sections with equal sums by making a single horizontal…

中等
3551

数位和排序需要的最小交换次数

Calculate the minimum swaps to sort an array by digit sum, ensuring correct order with tiebreaker values for efficiency.

中等
3552

网格传送门旅游

Find the minimum moves to traverse a 2D grid using standard steps and one-time portal teleports efficiently.

中等
3556

最大质数子字符串之和

Compute the sum of the three largest unique primes from all substrings using hash table plus math efficiently.

中等
3557

不相交子字符串的最大数量

Determine the maximum number of non-overlapping substrings in a word, each at least four characters and matching start-e…

中等
3558

给边赋权值的方案数 I

Calculate the number of valid edge weight assignments in a tree using DFS and binary-tree traversal with careful state t…

中等
3561

移除相邻字符

This problem focuses on removing adjacent characters in a string using a stack-based approach until no more operations a…

中等
3566

等积子集的划分方案

Determine if you can partition an array into two subsets with equal product using recursion and bit manipulation.

中等
3567

子矩阵的最小绝对差

Find the minimum absolute difference in each k x k submatrix within a given 2D grid using array and sorting techniques.

中等
3568

清理教室的最少移动

Solve the "Minimum Moves to Clean the Classroom" problem using array scanning and hash lookup for an optimized solution.

中等
3572

选择不同 X 值三元组使 Y 值之和最大

Select three distinct x-values from arrays to maximize the sum of their corresponding y-values efficiently using hashing…

中等
3573

买卖股票的最佳时机 V

Maximize profit from stock trades with at most k transactions using state transition dynamic programming for precise dec…

中等
3576

数组元素相等转换

Transform Array to All Equal Elements requires careful greedy choices and validating invariants to achieve uniformity ef…

中等
3577

统计计算机解锁顺序排列数

Calculate the total valid unlocking sequences for computers based on their complexity using array and combinatorics logi…

中等
3578

统计极差最大为 K 的分割方式数

Count the number of valid ways to partition an array into contiguous segments where max-min difference is at most k.

中等
3583

统计特殊三元组

Count Special Triplets requires scanning an array while tracking counts of previous and next values efficiently with has…

中等
3584

子序列首尾元素的最大乘积

Maximize the product of the first and last elements of any subsequence of size m in an integer array.

中等
3587

最小相邻交换至奇偶交替

Compute the minimum adjacent swaps to make array elements alternate between even and odd using greedy and invariant chec…

中等
3588

找到最大三角形面积

Find the maximum area of a triangle from 2D coordinates with at least one side parallel to the x-axis or y-axis.

中等
3589

计数质数间隔平衡子数组

Count the number of prime-gap balanced subarrays in an integer array using sliding window techniques and running state u…

中等
3592

硬币面值还原

Recover coin denominations from a numWays array using state transition dynamic programming to reconstruct valid sets eff…

中等
3593

使叶子路径成本相等的最小增量

Find the minimum number of increments needed to equalize leaf path scores in a tree with different node costs.

中等
3597

分割字符串

Partition a string into unique segments using hash table and string manipulation.

中等
3598

相邻字符串之间的最长公共前缀

Given an array of strings, find the longest common prefix length between adjacent strings after removals at each index.

中等
3599

划分数组得到最小 XOR

Partition an integer array into k subarrays to minimize the maximum XOR using state transition dynamic programming effic…

中等
3603

交替方向的最小路径代价 II

This problem focuses on finding the minimum cost path with alternating directions in a grid using dynamic programming.

中等
3604

有向图中到达终点的最少时间

The problem involves finding the minimum time to reach the destination in a directed graph with time-dependent edges.

中等
3607

电网维护

Determine which power stations remain connected after maintenance using array scanning and hash lookups to track compone…

中等
3608

包含 K 个连通分量需要的最小时间

Find the minimum time to remove edges such that a graph with n nodes has at least k connected components.

中等
3612

用特殊操作处理字符串 I

Simulate a series of operations on a string to transform it into the desired result using special characters.

中等
3613

最小化连通分量的最大成本

Minimize Maximum Component Cost leverages binary search over edge weights to optimize the cost of graph components after…

中等
3618

根据质数下标分割数组

Split Array by Prime Indices challenges you to separate elements at prime positions and minimize the absolute sum differ…

中等
3619

总价值可以被 K 整除的岛屿数目

Count the number of islands in a grid where the sum of each island's values is divisible by a given integer k.

中等
3623

统计梯形的数目 I

Given a list of distinct points, count the number of unique horizontal trapezoids that can be formed by selecting four p…

中等
3626

查找库存不平衡的店铺

Solve Find Stores with Inventory Imbalance by comparing cheapest and most expensive product stock within each store.

中等
3627

中位数之和的最大值

Maximize the sum of medians from subsequences of size 3 by choosing elements wisely from the array.

中等
3628

插入一个字母的最大子序列数

Maximize the number of "LCT" subsequences in a string after one insertion of an uppercase letter.

中等
3629

通过质数传送到达终点的最少跳跃次数

Solve the problem of finding the minimum jumps to reach the end of an array with prime teleportation steps.

中等
3634

使数组平衡的最少移除数目

Determine the fewest elements to remove from nums so the remaining array satisfies the maximum-to-minimum ratio within k…

中等
3635

最早完成陆地和水上游乐设施的时间 II

Determine the minimum completion time for a tourist to ride one land and one water ride using optimal scheduling.

中等
3638

平衡装运的最大数量

The Maximum Balanced Shipments problem requires forming the maximum number of balanced shipments from a given set of par…

中等
3639

变为活跃状态的最小时间

Find the minimum time to activate a string with a given order of replacements and a specific number of valid substrings.

中等

该难度高频题型

route

Guided Practice Path

AI recommends problems by your level and tracks your progress.

Start Guided Patharrow_forward
LeetCode 中等难度题解