题库chevron_right数组·哈希·扫描

数组·哈希·扫描 模式

418 道题目

模式页适合用来建立可复用解题框架。先识别题目特征,再按固定流程解释状态定义、转移和边界。

识别信号

  • Do you recognize how duplicate checks in rows, columns, and sub-boxes can be optimized using hash sets?
  • Can you map each board cell to its 3x3 sub-box index without extra loops?
  • Do you understand how backtracking helps with solving constraint satisfaction problems like Sudoku?

解题流程

  1. 1. 明确窗口/状态定义
  2. 2. 更新状态并维护约束
  3. 3. 用边界样例验证

常见失分点

  • Confusing the 3x3 sub-box indexing, which can lead to missed duplicates or false positives.
  • Not properly updating hash sets after placing numbers, which could lead to incorrect checks for subsequent placements.
  • Swapping incorrectly can lead to infinite loops or missed numbers.

推荐题单梯度

#题目难度
36

有效的数独

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

中等
37

解数独

Solve the Sudoku puzzle by filling empty cells while respecting Sudoku's rules using array scanning and backtracking.

困难
41

缺失的第一个正数

Identify the smallest missing positive integer in an unsorted array using constant space and linear time scanning techni…

困难
49

字母异位词分组

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

中等
73

矩阵置零

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

中等
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…

中等
128

最长连续序列

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

中等
139

单词拆分

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

中等
140

单词拆分 II

Given a string and dictionary, return all possible sentences by adding spaces where each word is in the dictionary.

困难
149

直线上最多的点数

Find the maximum number of points on a straight line in a 2D plane using array scanning and hash lookup.

困难
169

多数元素

Find the majority element in an array, where the element appears more than n/2 times, using efficient algorithms.

简单
217

存在重复元素

Determine if an integer array contains any duplicate values by efficiently scanning with a hash lookup to ensure fast de…

简单
219

存在重复元素 II

Check if any two equal numbers exist within k indices using array scanning and hash table lookup efficiently.

简单
229

多数元素 II

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

中等
268

丢失的数字

Find the missing number in an array containing distinct numbers in the range [0, n].

简单
336

回文对

Find all pairs of words in a list that form palindromes when concatenated using efficient scanning and hash mapping.

困难
347

前 K 个高频元素

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

中等
349

两个数组的交集

Find the intersection of two arrays while ensuring unique elements using efficient array scanning and hash lookups.

简单
350

两个数组的交集 II

Find the intersection of two arrays, accounting for multiple occurrences of the same number.

简单
380

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

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

中等
381

O(1) 时间插入、删除和获取随机元素 - 允许重复

This problem challenges you to design a data structure that supports insertion, removal, and random access with O(1) tim…

困难
391

完美矩形

Determine if given axis-aligned rectangles form a perfect cover using array scanning and hash-based corner counting tech…

困难
421

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

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

中等
442

数组中重复的数据

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

中等
447

回旋镖的数量

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

中等
448

找到所有数组中消失的数字

Identify all missing numbers in an array using efficient scanning and hash-based lookup for optimal performance.

简单
454

四数相加 II

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

中等
457

环形数组是否存在循环

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

中等
480

滑动窗口中位数

Compute the median for each sliding window of size k in an array using efficient array scanning and hash lookup techniqu…

困难
491

非递减子序列

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

中等
496

下一个更大元素 I

Find the next greater element for each number in nums1 from the nums2 array using an optimized approach.

简单
500

键盘行

Identify all words from a list that can be typed using letters from only one row of a standard American keyboard.

简单
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.

中等
525

连续数组

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

中等
532

数组中的 k-diff 数对

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

中等
554

砖墙

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

中等
560

和为 K 的子数组

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

中等
575

分糖果

Maximize the number of different candies Alice can eat given a set of candies and constraints on quantity.

简单
594

最长和谐子序列

Find the length of the longest harmonious subsequence in an integer array using array scanning and hash-based frequency …

简单
599

两个列表的最小索引总和

Find the common strings between two lists with the smallest index sum in this easy problem involving array scanning and …

简单
609

在系统中查找重复文件

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

中等
621

任务调度器

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

中等
632

最小区间

Find the minimal range covering at least one number from each of k sorted lists using array scanning and hash lookup eff…

困难
645

错误的集合

Identify the duplicated and missing numbers in an integer array using array scanning combined with hash table lookup eff…

简单
648

单词替换

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

中等
659

分割数组为连续子序列

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

中等
690

员工的重要性

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

中等
691

贴纸拼词

Determine the minimum number of stickers needed to spell a target word using array scanning and hash lookups for efficie…

困难
692

前K个高频单词

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

中等
697

数组的度

Find the shortest subarray with the same degree as the given array using efficient array scanning and hash lookups.

简单
705

设计哈希集合

Implement a custom HashSet without built-in libraries using array scanning and hash lookup for efficient membership chec…

简单
706

设计哈希映射

Implement a custom HashMap from scratch using array scanning and hash lookup without built-in libraries for efficient ke…

简单
710

黑名单中的随机数

Random Pick with Blacklist requires designing a method to uniformly pick integers while excluding blacklisted values eff…

困难
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…

中等
740

删除并获得点数

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

中等
745

前缀和后缀搜索

Design a dictionary to search words by both prefix and suffix using a Trie structure and hash lookups.

困难
748

最短补全词

Find the shortest word that completes the license plate by matching all required letters, considering frequency and case…

简单
752

打开转盘锁

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

中等
781

森林中的兔子

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

中等
792

匹配子序列的单词数

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

中等
804

唯一摩尔斯密码词

Determine how many unique Morse code transformations can be generated from a list of words using a hash table and array …

简单
811

子域名访问计数

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

中等
815

公交路线

Bus Routes is solved by BFS over buses and stops, using stop-to-route hashing to avoid expensive repeated route scans.

困难
817

链表组件

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

中等
819

最常见的单词

Find the most frequent non-banned word in a paragraph, excluding punctuation, using an efficient array scan and hash tab…

简单
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…

中等
833

字符串中的查找与替换

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

中等
839

相似字符串组

Determine the number of connected groups of similar strings by swapping at most two letters using array scanning and has…

困难
840

矩阵中的幻方

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

中等
846

一手顺子

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

中等
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…

中等
888

公平的糖果交换

Determine which single candy box Alice and Bob should swap to equalize their total candies using array scanning and hash…

简单
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.

中等
904

水果成篮

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

中等
911

在线选举

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

中等
914

卡牌分组

Solve the problem of determining if a deck can be partitioned into groups with equal occurrences of card values.

简单
916

单词子集

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

中等
923

三数之和的多种可能

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

中等
924

尽量减少恶意软件的传播

Identify which single infected node to remove to minimize total malware spread in a connected network graph efficiently.

困难
928

尽量减少恶意软件的传播 II

Minimize Malware Spread II asks to minimize the spread of malware in a network of nodes by removing one infected node.

困难
929

独特的电子邮件地址

Identify the count of unique email addresses by normalizing local names and using hash-based lookups efficiently.

简单
930

和相同的二元子数组

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

中等
939

最小面积矩形

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

中等
952

按公因数计算最大组件大小

Find the largest connected component in an array where edges exist between numbers sharing a common factor greater than …

困难
953

验证外星语词典

Verify if a sequence of words is sorted according to an alien language's custom alphabet order using array scanning and …

简单
954

二倍数对数组

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

中等
957

N 天后的牢房

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

中等
959

由斜杠划分区域

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

中等
961

在长度 2N 的数组中找出重复 N 次的元素

Find the element that is repeated exactly N times in a 2N-sized array using array scanning and hash lookups.

简单
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…

中等
974

和可被 K 整除的子数组

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

中等
982

按位与为零的三元组

Count all index triples in an array where the bitwise AND of their elements equals zero using efficient bit manipulation…

困难
992

K 个不同整数的子数组

Find subarrays with exactly k distinct integers in an integer array using sliding window and hash lookup techniques.

困难
996

平方数组的数目

Count the number of squareful arrays from the given list of integers by checking adjacent pairs' sums for perfect square…

困难
997

找到小镇的法官

Find the Town Judge is an easy LeetCode problem that challenges you to identify a town judge from trust relationships us…

简单
1001

网格照明

Grid Illumination uses an array scanning approach with hash lookups to check illuminated cells in a large grid based on …

困难
1002

查找共用字符

Return an array of common characters from all strings in the given list of words, including duplicates.

简单
1010

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

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

中等
1027

最长等差数列

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

中等
1036

逃离大迷宫

The 'Escape a Large Maze' problem involves navigating a massive grid with blocked squares and finding if a target can be…

困难
1048

最长字符串链

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

中等
1054

距离相等的条形码

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

中等
1072

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

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

中等
1074

元素和为目标值的子矩阵数量

Count all non-empty submatrices in a given matrix whose elements sum exactly to the target using efficient scanning tech…

困难
1090

受标签影响的最大值

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

中等
1110

删点成林

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

中等
1122

数组的相对排序

Sort arr1 by the relative order of arr2, with remaining elements placed in ascending order.

简单
1124

表现良好的最长时间段

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

中等
1128

等价多米诺骨牌对的数量

Count all pairs of dominoes that are equivalent by scanning the array and using a hash table for fast lookup.

简单
1146

快照数组

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

中等
1160

拼写单词

Compute the total length of words that can be fully constructed from given characters using array scanning and hash mapp…

简单
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…

中等
1177

构建回文串检测

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

中等
1178

猜字谜

Solve the "Number of Valid Words for Each Puzzle" problem with array scanning and hash lookup to efficiently count valid…

困难
1202

交换字符串中的元素

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

中等
1207

独一无二的出现次数

Determine if each integer in an array occurs a unique number of times using efficient hash-based counting and verificati…

简单
1218

最长定差子序列

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

中等
1224

最大相等频率

Find the longest prefix of an array where removing one element makes all numbers appear equally, using efficient hash tr…

困难
1248

统计「优美子数组」

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

中等
1275

找出井字棋的获胜者

Determine the winner of a Tic Tac Toe game by scanning moves and using hash lookups for rows, columns, and diagonals eff…

简单
1282

用户分组

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

中等
1284

转化为全零矩阵的最少反转次数

Compute the minimum flips to convert a binary matrix to zero by toggling cells and neighbors using array scanning plus h…

困难
1296

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

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

中等
1311

获取你好友已观看的视频

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

中等
1331

数组序号转换

Transform the elements of an array into their ranks, where the rank represents the size order of the elements.

简单
1338

数组大小减半

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

中等
1345

跳跃游戏 IV

Jump Game IV requires minimizing steps to reach the last index using jumps across equal values and neighbors efficiently…

困难
1346

检查整数及其两倍数是否存在

Solve Check If N and Its Double Exist by scanning once and checking doubles or halves in a hash set.

简单
1357

每隔 n 个顾客打折

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

中等
1365

有多少小于当前数字的数字

In this problem, you need to determine how many numbers are smaller than each element in an array, focusing on array sca…

简单
1366

通过投票对团队排名

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

中等
1386

安排电影院座位

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

中等
1394

找出数组中的幸运数

Identify the largest lucky integer in an array by counting frequencies and comparing values with their occurrences effic…

简单
1418

点菜展示表

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

中等
1436

旅行终点站

Find the destination city from a list of paths where each path connects two cities. The city with no outgoing path is th…

简单
1442

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

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

中等
1452

收藏清单

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

中等
1460

通过翻转子数组使两个数组相等

Solve Make Two Arrays Equal by Reversing Subarrays by checking whether target and arr contain the same values with match…

简单
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…

中等
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.

中等
1497

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

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

中等
1512

好数对的数目

Count all index pairs in an array where elements match and the first index is smaller, using hash-based scanning efficie…

简单
1546

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

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

中等
1562

查找大小为 M 的最新分组

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

中等
1577

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

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

中等
1590

使数组和能被 P 整除

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

中等
1604

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

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

中等
1630

等差子数组

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

中等
1636

按照频率将数组升序排序

Sort Array by Increasing Frequency requires counting each element and ordering them by frequency, breaking ties with des…

简单
1640

能否连接形成数组

Determine if an array can be formed by concatenating subarrays without reordering individual elements, using hash lookup…

简单
1656

设计有序流

Design an Ordered Stream that returns values in increasing order based on unique integer IDs with efficient insertion an…

简单
1658

将 x 减到 0 的最小操作数

Find the minimum number of operations to reduce a value x to zero by removing elements from an array.

中等
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.

中等
1684

统计一致字符串的数目

Count the number of strings fully composed of allowed characters using array scanning and hash lookup for efficiency.

简单
1695

删除子数组的最大得分

Maximize the score by erasing a subarray with unique elements in an array of integers.

中等
1711

大餐计数

Count Good Meals asks you to find pairs of food items with a sum of deliciousness equal to a power of two.

中等
1713

得到子序列的最少操作次数

Compute the minimum insertions required to transform arr so that target becomes its subsequence using array scanning and…

困难
1726

同积元组

Given an array of distinct integers, return the number of tuples where the product of two pairs is the same.

中等
1733

需要教语言的最少人数

Minimize the number of users to teach a language that ensures all friends can communicate in a social network.

中等
1743

从相邻元素对还原数组

Restore the Array From Adjacent Pairs reconstructs a sequence using adjacent element pairs. Efficient hash lookups and a…

中等
1748

唯一元素的和

Given an array, find the sum of all its unique elements by identifying those that appear only once.

简单
1775

通过最少操作次数使数组的和相等

Solve the problem of balancing the sums of two integer arrays with minimal operations, using array scanning and hash loo…

中等
1782

统计点对的数目

Given a graph with nodes and edges, count pairs of nodes where the degree sum exceeds a given threshold for each query.

困难
1807

替换字符串中的括号内容

Quickly evaluate a string with bracketed keys using array scanning and hash table lookups for efficient replacements.

中等
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.

中等
1865

找出和为指定值的下标对

Efficiently track and count pairs across two arrays using array scanning plus hash lookup to support dynamic updates.

中等
1893

检查是否区域内所有整数都被覆盖

Check if all integers in the range [left, right] are covered by intervals in a given set of ranges.

简单
1906

查询差绝对值的最小值

Compute minimum absolute differences for subarrays efficiently using array scanning and hash table lookups, leveraging b…

中等
1912

设计电影租借系统

Implement a movie rental system with efficient search, rent, drop, and report operations using arrays and hash lookups.

困难
1938

查询最大基因差

Find the maximum genetic difference along paths in a tree using array scanning and hash lookups with XOR calculations.

困难
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.

中等
1948

删除系统中的重复文件夹

Solve Delete Duplicate Folders in System by building a trie, serializing child subtrees, and deleting repeated non-empty…

困难
1980

找出不同的二进制字符串

Find a binary string of length n not in the input array using array scanning and hash lookup efficiently.

中等
1993

树上的操作

Design a tree data structure that allows locking, unlocking, and upgrading nodes with user-specific actions.

中等
1994

好子集的数目

Find the number of good subsets in an integer array, where each subset's product is the product of distinct primes.

困难
1995

统计特殊四元组

Count Special Quadruplets requires scanning arrays and using hash lookups to efficiently find quadruplets matching sum c…

简单
2001

可互换矩形的组数

Count all pairs of rectangles that share the exact width-to-height ratio using efficient array scanning and hash lookup.

中等
2006

差的绝对值为 K 的数对数目

Find how many pairs (i, j) with i < j satisfy |nums[i] - nums[j]| == k using array scanning and hash lookup.

简单
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.

中等
2009

使数组连续的最少操作数

Find the minimum number of operations to make an array continuous by modifying elements using array scanning and hash lo…

困难
2013

检测正方形

Detect Squares requires tracking points on a 2D plane to quickly count all possible axis-aligned squares using efficient…

中等
2023

连接后等于目标字符串的字符串对

Count all unique index pairs in a string array whose concatenation exactly matches the given target string using efficie…

中等
2025

分割数组的最多方案数

Determine the maximum number of ways to split an array into equal sums using at most one element change, leveraging pref…

困难
2032

至少在两个数组中出现的值

Identify all elements appearing in at least two of three arrays using efficient scanning and hash lookups for fast verif…

简单
2043

简易银行系统

Design a simple bank system that processes transactions like withdrawals, deposits, and transfers while managing account…

中等
2053

数组中第 K 个独一无二的字符串

Find the kth distinct string in an array by identifying strings that appear only once, using efficient array scanning an…

简单
2080

区间内查询数字的频率

Design a data structure to handle efficient frequency queries for subarrays, focusing on hash-based lookups and efficien…

中等
2085

统计出现过一次的公共字符串

Learn how to efficiently count strings appearing exactly once in both arrays using array scanning and hash lookup patter…

简单
2094

找出 3 位偶数

Generate unique 3-digit even numbers from a given array of digits with duplicates.

简单
2099

找到和最大的长度为 K 的子序列

Pick the k largest values, then restore their original order to build the maximum-sum subsequence correctly.

简单
2115

从给定原材料中找到所有可以做出的菜

Determine all recipes you can prepare given initial supplies and ingredient dependencies, leveraging array scanning and …

中等
2121

相同元素的间隔之和

Solve the problem of calculating intervals between identical elements using array scanning and hash lookup.

中等
2122

还原原数组

Recover the Original Array helps you understand how to reverse-engineer an array from two subsets using array scanning a…

困难
2131

连接两字母单词得到的最长回文串

Find the maximum-length palindrome by combining two-letter words using array scanning and hash table lookups efficiently…

中等
2133

检查是否每一行每一列都包含全部整数

Determine if every row and column in a square matrix contains all numbers from 1 to n without repetition using array sca…

简单
2135

统计追加字母可以获得的单词数

Given startWords and targetWords, check how many targetWords can be formed by adding one letter and rearranging letters …

中等
2150

找出数组中的所有孤独数字

Find lonely numbers in an array where each lonely number appears once and has no adjacent values.

中等
2154

将找到的值乘以 2

The "Keep Multiplying Found Values by Two" problem involves repeatedly multiplying a number by two if it is found in an …

简单
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.

中等
2190

数组中紧跟 key 之后出现最频繁的数字

Scan the array once, count which value appears right after the key, and return the uniquely most frequent follower.

简单
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.

中等
2206

将数组划分成相等数对

Determine if an array of 2n integers can be partitioned into n pairs where each pair contains identical elements using h…

简单
2215

找出两数组的不同

Find the Difference of Two Arrays helps you identify unique elements between two integer arrays using array scanning and…

简单
2225

找出输掉零场或一场比赛的玩家

Identify players with zero or one losses by efficiently scanning arrays and counting losses using hash lookups for accur…

中等
2227

加密解密字符串

The 'Encrypt and Decrypt Strings' problem involves creating a data structure that can encrypt and decrypt strings using …

困难
2244

完成所有任务需要的最少轮数

The problem requires finding the minimum rounds to complete tasks, focusing on greedy algorithms and hash table lookups.

中等
2248

多个数组求交集

Find integers that are common across all arrays in a given list of arrays.

简单
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.

中等
2251

花期内花的数目

Find the number of flowers in full bloom at the given times for a list of people.

困难
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…

中等
2273

移除字母异位词后的结果数组

This problem requires removing adjacent anagrams from a list of words using an array scanning and hash lookup approach.

简单
2275

按位与结果大于零的最长组合

Find the largest group of integers in an array whose bitwise AND is greater than zero using array scanning and hash look…

中等
2284

最多单词数的发件人

Find the sender with the largest total word count by scanning messages and tallying counts using a hash table efficientl…

中等
2295

替换数组中的元素

Replace Elements in an Array involves applying a series of operations to replace values in an array with new ones based …

中等
2301

替换字符后匹配

Determine if a target substring can appear in a string after optional character replacements using given mappings effici…

困难
2306

公司命名

The "Naming a Company" problem requires determining the number of valid distinct company names from a list of name ideas…

困难
2341

数组能形成多少数对

Given an array, count how many pairs can be formed and how many leftovers remain after pairing.

简单
2342

数位和相等数对的最大和

Find the maximum sum of two numbers with equal digit sums in a given array of positive integers.

中等
2347

最好的扑克手牌

Determine the strongest poker hand from five cards using array scanning and hash table counting techniques efficiently.

简单
2350

不可能得到的最短骰子序列

Find the shortest subsequence that cannot be formed from a sequence of dice rolls, with efficient array scanning and has…

困难
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.

中等
2354

优质数对的数目

Calculate the number of excellent pairs in an array using bit counting, hash sets, and efficient pair scanning technique…

困难
2357

使数组中所有元素都等于零

Minimize operations to make all array elements zero by subtracting equal amounts in each operation.

简单
2363

合并相似的物品

Merge Similar Items combines values and weights from two lists, returning the result sorted by value.

简单
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.

中等
2367

等差三元组的数目

Count the number of arithmetic triplets in a given strictly increasing array with a specified difference.

简单
2368

受限条件下可到达节点的数目

In the 'Reachable Nodes With Restrictions' problem, find the maximum reachable nodes from node 0 in a tree while avoidin…

中等
2395

和相等的子数组

Find Subarrays With Equal Sum is solved by scanning adjacent pairs and storing each length-2 sum in a hash set.

简单
2399

检查相同字母间的距离

Verify if each pair of identical letters in a string has the exact number of letters between them as specified in a dist…

简单
2402

会议室 III

Determine which meeting room holds the most meetings by simulating room assignments with precise time tracking.

困难
2404

出现最频繁的偶数元素

Identify the most frequent even element in an array using counting and hash lookup, handling ties by choosing the smalle…

简单
2418

按身高排序

Sort the People requires pairing names with heights and sorting them in descending height order efficiently using arrays…

简单
2421

好路径的数目

Count all good paths in a tree by scanning node values and using hash maps to track valid connections efficiently.

困难
2441

与对应负数同时存在的最大正整数

Find the largest positive integer in an array such that its negative counterpart also exists.

简单
2442

反转之后不同整数的数目

This problem requires counting distinct integers after performing reverse operations on each integer in an array.

中等
2451

差值数组不同的字符串

Identify the one string in an array whose consecutive letter differences deviate from all others using array scanning pl…

简单
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…

中等
2461

长度为 K 子数组中的最大和

Find the maximum sum of all distinct-element subarrays of length k using array scanning and hash lookup techniques.

中等
2465

不同的平均值数目

Calculate the number of unique averages formed by repeatedly pairing smallest and largest elements efficiently using has…

简单
2475

数组中不等三元组的数目

Count all triplets in a positive integer array where each element is distinct using scanning and hash lookup efficiently…

简单
2488

统计中位数为 K 的子数组

Count the number of subarrays in a given array with median equal to a specified value k.

困难
2491

划分技能点相等的团队

Divide players into equal skill teams and return the sum of their chemistry, or -1 if impossible.

中等
2499

让数组不相等的最小总代价

Calculate the minimum cost to rearrange nums1 so that no element matches nums2 using optimal swaps and hash counting.

困难
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.

中等
2506

统计相似字符串对的数目

Count similar string pairs by converting each word into a character-set signature and counting matching signatures effic…

简单
2512

奖励最顶尖的 K 名学生

Calculate top K student scores by scanning reports and using hash tables for positive and negative word lookups efficien…

中等
2521

数组乘积中的不同质因数数目

Find the number of distinct prime factors in the product of an array of integers.

中等
2537

统计好子数组的数目

Count the number of subarrays that contain at least k pairs of equal elements using array scanning and hash lookup.

中等
2540

最小公共值

Find the smallest integer appearing in both sorted arrays efficiently using array scanning and hash-based lookup techniq…

简单
2547

拆分数组的最小代价

Minimize the cost of splitting an array into k subarrays by calculating importance values and applying dynamic programmi…

困难
2549

统计桌面上的不同数字

Compute the number of distinct integers generated on a board using repeated modulo operations over a long sequence of da…

简单
2554

从一个范围内选择最多整数 I

Determine the maximum count of integers from 1 to n avoiding banned numbers while keeping the sum under maxSum.

中等
2561

重排水果

Solve the problem of rearranging fruit baskets by comparing fruit costs and minimizing swaps using array scanning and ha…

困难
2564

子字符串异或查询

Solve the Substring XOR Queries problem using array scanning and hash lookup to efficiently handle multiple queries on b…

中等
2570

合并两个二维数组 - 求和法

Merge two 2D arrays by summing values with matching ids using array scanning and hash lookup efficiently.

简单
2581

统计可能的树根数目

Given a tree and a set of guesses, find how many nodes can be the root while satisfying the guess constraints.

困难
2584

分割数组使乘积互质

Find the smallest index to split an array so that the products of two parts are coprime using array scanning and hash lo…

困难
2588

统计美丽子数组数目

Count the Number of Beautiful Subarrays is a Medium-level problem involving array scanning and hash table lookup to find…

中等
2593

标记所有元素后数组的分数

The problem involves marking elements in an array and calculating the score based on adjacent elements.

中等
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…

中等
2605

从两个数字数组里生成最小数字

Given two arrays of digits, find the smallest possible number formed by one digit from each array.

简单
2606

找到最大开销的子字符串

Find the Substring With Maximum Cost requires calculating substring values using a hash lookup for character costs, with…

中等
2610

转换二维数组

Learn how to convert an integer array into a 2D array with distinct rows using array scanning plus hash lookup efficient…

中等
2615

等值距离和

In this problem, you calculate an array where each element is the sum of absolute differences of indices for equal value…

中等
2653

滑动子数组的美丽值

Compute the xth smallest negative number in each sliding subarray using array scanning and hash frequency tracking effic…

中等
2657

找到两个数组的前缀公共数组

This problem challenges you to find the prefix common array of two integer permutations, utilizing array scanning and ha…

中等
2661

找出叠涂元素

Find the first index where a row or column is completely painted in a matrix based on an array of integers.

中等
2670

找出不同元素数目差数组

Calculate the distinct difference array of a given list of integers by counting distinct elements in the prefix and suff…

简单
2682

找出转圈游戏输家

Simulate a ball-passing game around a circle using array scanning and hash lookup to find friends who never receive the …

简单
2707

字符串中的额外字符

The problem asks for the minimum number of extra characters left after optimally breaking a string into substrings found…

中等
2711

对角线上不同值的数量差

Find the difference in the number of distinct diagonal values in a matrix, returning results in a new matrix.

中等
2713

矩阵中严格递增的单元格数

Find the maximum number of cells that can be visited in a matrix by following strictly increasing values from a starting…

困难
2718

查询后矩阵的和

Calculate the total sum of a zero-filled n x n matrix after sequentially applying row and column update queries efficien…

中等
2732

找到矩阵中的好子集

Find a Good Subset of the Matrix is a challenging problem involving array scanning, hash lookup, and bit manipulation to…

困难
2744

最大字符串配对数目

Find the maximum number of pairs of distinct strings from an array where one string is the reverse of the other.

简单
2747

统计没有收到请求的服务器数目

Count Zero Request Servers finds the number of servers with zero requests during specific time intervals for a given set…

中等
2748

美丽下标对的数目

Count all index pairs in an array where the first digit of one number and last digit of another are coprime efficiently.

简单
2763

所有子数组中不平衡数字之和

Learn how to compute the total imbalance across all subarrays by updating gap counts as each subarray expands.

困难
2766

重新放置石块

Relocate marbles to new positions in an array by simulating moves, and return sorted occupied positions.

中等
2768

黑格子的数目

Calculate the number of black blocks in a grid given a list of black cell coordinates.

中等
2780

合法分割的最小下标

Find the minimum index to split an array such that both subarrays have the same dominant element.

中等
2781

最长合法子字符串的长度

This problem asks for the longest valid substring of a word that doesn't contain any substrings from a forbidden list.

困难
2784

检查数组是否是好的

Determine if a given integer array is a permutation of base[n], containing 1 to n-1 once and n twice, using scanning and…

简单
2799

统计完全子数组的数目

Count Complete Subarrays in an Array requires scanning the array while tracking elements to detect subarrays with all di…

中等
2808

使循环数组所有元素相等的最少秒数

Find the minimum number of seconds to equalize a circular array using array scanning and hash lookup techniques.

中等
2813

子序列最大优雅度

Maximize elegance of a k-length subsequence from a list of items with profits and categories.

困难
2815

数组中的最大数对和

Find the maximum sum of two numbers in an array sharing the same largest digit using a hash-based scan efficiently.

简单
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…

中等
2841

几乎唯一子数组的最大和

Find the maximum sum of subarrays that contain at least m distinct elements using array scanning and hash lookups effici…

中等
2845

统计趣味子数组的数目

Count all subarrays where the number of elements satisfying a modulo condition equals a target k using efficient prefix …

中等
2848

与车相交的点

Count covered integer points by merging overlapping car intervals or marking visited positions on the number line.

简单
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.

中等
2869

收集元素的最少操作次数

Scan from the end, track seen values from 1 to k, and stop once every required number is collected.

简单
2870

使数组为空的最少操作次数

Minimize the number of operations to make an array empty by leveraging array scanning and hash lookup.

中等
2875

无限数组的最短子数组

Find the shortest subarray in an infinite array that sums to a given target using array scanning and hash lookup.

中等
2897

对数组执行操作使平方和最大

Maximizing the sum of squares in an array through bitwise operations on selected elements.

困难
2902

和带限制的子多重集合的数目

This problem asks you to count the number of sub-multisets within a given array that have a sum in a specified range.

困难
2910

合法分组的最少组数

The problem involves sorting balls into boxes while minimizing the number of boxes, adhering to size constraints.

中等
2913

子数组不同元素数目的平方和 I

Compute the sum of squares of distinct elements for all subarrays using array scanning with hash lookups efficiently.

简单
2932

找出强数对的最大异或值 I

Find the maximum XOR of any strong pair in an integer array using array scanning and hash-based lookups efficiently.

简单
2933

高访问员工

Identify employees with high system access within one-hour periods based on access logs.

中等
2935

找出强数对的最大异或值 II

Find the maximum XOR among strong pairs in an array using array scanning and hash-based lookups efficiently.

困难
2956

找到两个数组中的公共元素

Quickly find all numbers that appear in both arrays using scanning and hash lookup to handle duplicates efficiently.

简单
2958

最多 K 个重复元素的最长子数组

Find the maximum length subarray where each number appears at most k times using array scanning and hash lookups.

中等
2963

统计好分割方案的数目

Calculate how many ways to partition an array into contiguous subarrays where no number repeats across segments using ha…

困难
2965

找出缺失和重复的数字

Find the missing and repeated numbers in an n x n grid using array scanning and hash lookup.

简单
2975

移除栅栏得到的正方形田地的最大面积

This problem challenges you to calculate the largest square area possible by removing fences from a given rectangular fi…

中等
2996

大于等于顺序前缀和的最小缺失整数

Find the smallest missing integer greater than the sum of the longest sequential prefix in an array.

简单
3002

移除后集合的最多元素数

Maximize a set size by strategically removing half of elements from two arrays using hash lookups and array scanning.

中等
3005

最大频率元素计数

Count Elements With Maximum Frequency is solved by counting each value, tracking the highest count, and summing matching…

简单
3013

将数组分成最小总代价的子数组 II

This problem asks to divide an array into subarrays with a minimal cost and certain constraints on subarray positions.

困难
3020

子集中元素的最大数量

This problem asks you to find the maximum subset size where each number in the subset follows a specific pattern with ha…

中等
3026

最大好子数组和

Find the maximum sum of any subarray where the first and last elements differ by exactly k using efficient array scannin…

中等
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.

中等
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…

中等
3046

分割数组

Determine if an even-length array can be split into two parts with all distinct elements using hash lookup scanning.

简单
3071

在矩阵上写出字母 Y 所需的最少操作次数

Find the minimum number of operations to write the letter Y on a grid by altering cell values.

中等
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…

中等
3092

最高频率的 ID

Track the most frequent ID after each update in a dynamic collection of IDs with changing frequencies.

中等
3128

直角三角形

Count all possible right triangles in a 2D boolean grid using array scanning and hash lookup for efficiency.

中等
3134

找出唯一性数组的中位数

Given a nums array, find the median of its uniqueness array by considering all subarrays and their distinct element coun…

困难
3143

正方形中的最多点数

Find the maximum number of points inside a valid square centered at the origin using a scanning and hashing approach.

中等
3153

所有数对中数位差之和

Sum of Digit Differences of All Pairs is a problem that involves counting digit differences in pairs from an array of in…

中等
3158

求出出现两次数字的 XOR 值

Find the XOR of numbers appearing twice by scanning the array and using a hash table for efficient tracking and combinat…

简单
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…

中等
3162

优质数对的总数 I

Count all good pairs where an element in nums1 is divisible by a scaled element in nums2 using efficient array scanning.

简单
3164

优质数对的总数 II

Calculate total good pairs by scanning two arrays and using hash lookup to match divisible elements efficiently with k.

中等
3176

求出最长好子序列 I

Find the maximum length of a good subsequence by scanning arrays and using hash lookups for value remapping efficiently.

中等
3177

求出最长好子序列 II

Determine the maximum length of a good subsequence in an integer array using array scanning and hash lookup efficiently.

困难
3184

构成整天的下标对数目 I

Count all pairs in an array where their sum forms a complete day using hash-based counting for efficiency.

简单
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…

中等
3217

从链表中移除在数组中存在的节点

Remove nodes from a linked list if their values exist in a given array.

中等
3224

使差值相等的最少数组改动次数

Minimize changes to make array differences equal by replacing elements within a given range.

中等
3238

求出胜利玩家的数目

Find how many players in a game win by picking more balls of a single color than their index position.

简单
3242

设计相邻元素求和服务

Design a service that computes sums for adjacent and diagonal elements in a 2D grid.

简单
3265

统计近似相等数对 I

Count Almost Equal Pairs I involves finding pairs of elements that can be made equal by swapping at most one digit.

中等
3267

统计近似相等数对 II

Count the number of almost equal integer pairs in an array using array scanning and hash lookup efficiently.

困难
3289

数字小镇中的捣蛋鬼

Find the two numbers that appear twice in a list of integers from 0 to n-1 using array scanning plus hash lookup efficie…

简单
3295

举报垃圾信息

Determine if a message contains at least two banned words using array scanning and hash lookup.

中等
3311

构造符合图结构的二维矩阵

This problem challenges you to construct a 2D grid from an undirected graph using a given set of edges.

困难
3312

查询排序后的最大公约数

Solve the Sorted GCD Pair Queries problem by efficiently counting and locating GCDs of all array pairs using hash mappin…

困难
3316

从原字符串里进行删除操作的最多次数

Determine the maximum number of characters you can remove from source while keeping pattern as a subsequence using array…

中等
3318

计算子数组的 x-sum I

Compute the x-sum of every subarray of length k efficiently using array scanning combined with hash lookup techniques.

简单
3321

计算子数组的 x-sum II

Calculate the x-sum for every k-length subarray using efficient array scanning and hash-based counting techniques.

困难
3327

判断 DFS 字符串是否是回文串

Determine if strings formed by DFS traversal of a tree are palindromes using array scanning and hash lookups efficiently…

困难
3331

修改后子树的大小

Calculate the sizes of all subtrees after simultaneous parent changes using array scanning and hash-based counting effic…

中等
3351

好子序列的元素之和

Calculate the sum of all good subsequences in an array where consecutive numbers differ by exactly one.

困难
3371

识别数组中的最大异常值

Identify the largest outlier in an integer array using scanning and hash lookup for efficient detection and validation.

中等
3375

使数组的值全部为 K 的最少操作次数

Find the minimum operations to convert an array to all values equal k using array scanning and hash lookup efficiently.

简单
3378

统计最小公倍数图中的连通块数目

Determine the number of connected components in an LCM-based graph using array scanning and hash-based connectivity chec…

困难
3381

长度可被 K 整除的子数组的最大元素和

Find the maximum sum of a subarray where the length of the subarray is divisible by k.

中等
3395

唯一中间众数子序列 I

Count subsequences of size 5 with a unique middle mode in an integer array using hash table and combinatorics.

困难
3396

使数组元素互不相同所需的最少操作次数

Find the minimum number of operations to make all elements of an array distinct.

简单
3404

统计特殊子序列的数目

Count the number of special subsequences in an array of positive integers, focusing on efficient array scanning and hash…

中等
3425

最长特殊路径

Compute the longest downward path in a tree with unique node values using DFS, hash lookup, and careful array scanning.

困难
3434

子数组操作后的最大频率

Determine the maximum frequency of a target value k after applying one subarray addition operation efficiently using arr…

中等
3447

将元素分配给有约束条件的组

Assign elements to groups by size constraints with a sieve-like approach to find suitable element matches efficiently.

中等
3471

找出最大的几近缺失整数

Find the largest almost missing integer in an array where it appears in exactly one subarray of size k.

简单
3483

不同三位偶数的数目

Given an array of digits, find how many distinct 3-digit even numbers can be formed without repetition of digits and no …

简单
3484

设计电子表格

Design a spreadsheet that supports setting, retrieving, and resetting values, with the ability to handle formulas refere…

中等
3486

最长特殊路径 II

Find the longest downward path in a tree where node values are mostly distinct, allowing one repeat, using array scannin…

困难
3487

删除后的最大子数组元素和

Maximize the sum of a subarray after performing deletions, ensuring elements remain unique.

简单
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…

中等
3505

使 K 个子数组内元素相等的最少操作数

Compute the minimum operations to ensure at least k non-overlapping subarrays of size x have all equal elements efficien…

困难
3507

移除最小数对使数组有序 I

This problem asks for the minimum number of operations to make an array non-decreasing by removing pairs of elements.

简单
3508

设计路由器

Efficiently design a Router class to manage network packets with memory limits using array scanning and hash lookups.

中等
3509

最大化交错和为 K 的子序列乘积

Find the maximum product of a subsequence in an array with an alternating sum equal to a given target.

困难
3510

移除最小数对使数组有序 II

The problem asks to find the minimum number of operations to make an array non-decreasing by removing pairs of elements.

困难
3522

执行指令后的得分

Simulate a series of add and jump instructions on arrays to compute the final score efficiently using array scanning and…

中等
3527

找到最常见的回答

Find the most common survey response after eliminating duplicates within each day, using array scanning and hash lookups…

中等
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.

中等
3542

将所有元素变为 0 的最少操作次数

Calculate the fewest operations to turn all numbers in an array to zero using subarray minimum elimination strategy.

中等
3548

等和矩阵分割 II

Determine if a matrix can be partitioned into two sections with an equal sum using a single cut.

困难
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.

中等
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…

中等
3583

统计特殊三元组

Count Special Triplets requires scanning an array while tracking counts of previous and next values efficiently with has…

中等
3588

找到最大三角形面积

Find the maximum area of a triangle from 2D coordinates with at least one side parallel to the x-axis or y-axis.

中等
3591

检查元素频次是否为质数

Check if any element in the array has a prime frequency count, leveraging array scanning and hash table lookup.

简单
3606

优惠券校验器

The Coupon Code Validator problem requires filtering and sorting coupons based on specific criteria for validity.

简单
3607

电网维护

Determine which power stations remain connected after maintenance using array scanning and hash lookups to track compone…

中等
3623

统计梯形的数目 I

Given a list of distinct points, count the number of unique horizontal trapezoids that can be formed by selecting four p…

中等
3625

统计梯形的数目 II

Count Number of Trapezoids II requires scanning point pairs and hashing slopes to efficiently find parallel sides in arr…

困难

关联题型

LeetCode 数组·哈希·扫描模式题解:418题训练路线