识别信号
- Focus on in-place array manipulation rather than creating a new matrix.
- Check if candidate uses both transpose and row reversal, showing understanding of index math.
- Can the candidate handle the carry and array resizing efficiently?
解题流程
- 1. 明确窗口/状态定义
- 2. 更新状态并维护约束
- 3. 用边界样例验证
常见失分点
- Trying to rotate using an extra matrix, which violates in-place constraint.
- Forgetting to handle carry-over when incrementing digits.
- Attempting to divide every number by all smaller numbers instead of using a sieve.
推荐题单梯度
旋转图像
Rotate an n x n matrix 90 degrees clockwise in-place using array manipulation and mathematical indexing techniques effic…
加一
Given a number as an array of digits, increment it by one and return the updated array of digits.
计数质数
Count all prime numbers less than a given integer n using efficient array and math-based enumeration techniques.
路径交叉
Determine if a path defined by sequential distances on a 2D plane crosses itself using array and math reasoning.
打乱数组
Shuffle an Array requires designing a class to randomly permute an integer array while ensuring all permutations are equ…
最小操作次数使数组元素相等
Compute the fewest steps to make all elements equal by incrementing n-1 array items, applying array and math reasoning.
最小操作次数使数组元素相等 II
Find the minimum moves to equalize all array elements using increments or decrements with array and math techniques.
汉明距离总和
Calculate the total Hamming distance between all pairs in an integer array using efficient bit manipulation techniques.
最小时间差
Calculate the smallest time difference between clock points using array manipulation and mathematical conversions effici…
安装栅栏
Find the perimeter fence of a garden by determining the outermost trees in a set of given tree coordinates.
区间加法 II
Range Addition II requires counting maximum values in a matrix after incremental operations using array and math reasoni…
三个数的最大乘积
Find three numbers in an array whose product is the largest using sorting and careful handling of negative values.
优美的排列 II
Construct a beautiful arrangement of integers from 1 to n with k distinct integers, optimizing for time and space effici…
全局倒置与局部倒置
Determine if every global inversion in a permutation array is also a local inversion using array and math logic efficien…
变为棋盘
Determine the minimum swaps of rows or columns to convert an n x n binary board into a valid chessboard configuration.
逃脱阻碍者
Escape The Ghosts tests your ability to analyze movements in an infinite grid while racing against ghost positions using…
黑板异或游戏
The Chalkboard XOR Game is a game theory problem involving array manipulation and bitwise XOR, where players alternate e…
最大三角形面积
Find the area of the largest triangle formed by three distinct points on a 2D plane.
猜猜这个单词
Master the Guess the Word problem by applying array manipulation, match-counting math, and strategic interactive guessin…
三维形体投影面积
Calculate the projection area of a 3D shape defined by a grid of towers with varying heights.
子序列宽度之和
Calculate the sum of widths for all subsequences in an integer array using sorting and combinatorial math efficiently.
三维形体的表面积
Solve the Surface Area of 3D Shapes problem using array manipulation and mathematical formulas to calculate surface area…
最小差值 I
Find the smallest score of an array after applying an operation to each element within a given range.
三等分
Divide a binary array into three contiguous parts such that each part represents the same integer value in binary, using…
漂亮数组
Beautiful Array builds a valid permutation by recursively separating odd and even positions so no middle-average triple …
最接近原点的 K 个点
Find the k closest points to the origin in a 2D plane using array operations and Euclidean distance calculations efficie…
数组形式的整数加法
Compute the sum of an integer and a number represented as an array, efficiently handling digit carries and array travers…
距离顺序排列矩阵单元格
Compute all matrix cell coordinates sorted by Manhattan distance from a given center using array and math techniques eff…
有效的回旋镖
Determine if three points on a 2D plane form a boomerang, based on distinctness and non-collinearity.
负二进制数相加
Add two numbers represented in negabinary format and return the result in the same format.
大样本统计
Calculate minimum, maximum, mean, median, and mode from a large sample represented by an array of counts.
绝对值表达式的最大值
Calculate the largest sum of absolute differences across two arrays and their indices using an efficient pattern-based a…
缀点成线
Determine if a series of coordinates form a straight line on a 2D plane using geometry and mathematical principles.
检查「好数组」
Determine if a given array of positive integers can generate 1 using integer multiples of any subset, leveraging number …
奇数值单元格的数目
This problem involves updating a matrix based on given indices and counting cells with odd values afterward.
访问所有点的最小时间
Calculate the minimum seconds required to visit all given 2D points in order using optimal diagonal or straight moves.
统计位数为偶数的数字
Count the integers in an array that have an even number of digits using a direct array traversal with digit math.
和为零的 N 个不同整数
Generate an array of n unique integers that sum to zero using a symmetric pairing strategy to ensure balance.
最后 K 个数的乘积
Design a data structure to efficiently return the product of the last k numbers in a dynamic integer stream using prefix…
四因数
Compute the sum of all divisors for numbers in an array that have exactly four divisors using array and math techniques.
圆形靶内的最大飞镖数量
Maximize the number of darts on a circular dartboard given dart positions and radius.
服务中心的最佳位置
Find the optimal service center position in a city by minimizing the sum of Euclidean distances to all customers.
所有奇数长度子数组的和
Calculate the sum of all odd-length subarrays in a given integer array using efficient array and math strategies.
带阈值的图连通性
In 'Graph Connectivity With Threshold,' determine if cities are connected based on common divisors exceeding a threshold…
有序数组中差绝对值之和
Calculate the sum of absolute differences between each element and others in a sorted array efficiently.
还原排列的最少操作步数
Find the minimum number of operations to reinitialize a permutation of size n using specific operations.
序列中不同最大公约数的数目
Given an array of positive integers, find the number of different subsequences' GCDs.
数组元素积的符号
Determine the sign of a product from an integer array using a single pass without computing the full product.
统计一个圆中点的数目
Determine how many 2D points lie within multiple circles using array iteration and Euclidean distance calculations effic…
所有数对按位与结果的异或和
Compute the XOR sum of all pairwise ANDs between two integer arrays using array and bitwise math techniques efficiently.
最高建筑高度
Find the maximum building height in a city given height restrictions for specific buildings.
矩阵中最大的三个菱形和
Find the three largest distinct rhombus sums from a given grid using array and math techniques.
找出数组的最大公约数
Find the greatest common divisor of the smallest and largest numbers in an integer array.
数组的最大公因数排序
The GCD Sort problem challenges you to sort an array using a specific gcd-based swap method.
找出缺失的观测数据
Given a set of dice rolls, calculate the missing observations based on the mean and return them or determine if it's imp…
获取单值网格的最小操作数
Determine the fewest additions or subtractions of x to make all grid elements identical using array and math logic.
银行中的激光束数量
Calculate total laser beams in a bank floor plan using array counting and math logic between security devices on differe…
统计可以被 K 整除的下标对数目
Count Array Pairs Divisible by K requires counting index pairs whose products are divisible by a given number k.
找到指定长度的回文数
Find the smallest palindromes of a given length for specific queries with mathematical and array manipulation.
数组的三角和
The problem asks for calculating the triangular sum of an array through repeated pairwise summation.
表示一个折线图的最少线段数
Determine the fewest lines needed to accurately connect stock price points in a line chart using array and math reasonin…
操作后的最大异或和
Maximize the bitwise XOR of an array after applying a special operation with non-negative integers multiple times.
使数组可以被整除的最少删除次数
Find the minimum number of deletions to make the smallest element in nums divide all elements of numsDivide.
全 0 子数组的数目
Given an array of integers, count the subarrays that consist entirely of 0s.
最大公因数等于 K 的子数组数目
Count the number of subarrays with GCD equal to a given value k from a list of integers.
可被三整除的偶数的平均值
Find the average of even numbers divisible by 3 from an array of positive integers.
最小公倍数等于 K 的子数组数目
Find the number of subarrays in an array where the least common multiple (LCM) of the subarray equals a given integer k.
查询数组异或美丽值
Find the xor-beauty of an array by XORing the effective values of all possible triplets of indices.
数组元素和与数字和的绝对差
Find the absolute difference between element sum and digit sum of an array of integers.
找出字符串的可整除数组
Calculate the divisibility array for a string by checking if prefixes are divisible by a given number.
对角线上的质数
Find the largest prime number located on any diagonal of a square matrix using array iteration and prime checking techni…
使数组所有元素变成 1 的最少操作次数
Find the minimum number of operations to transform every element of a positive integer array into 1 using gcd operations…
最大公约数遍历
Determine if every index in an array can be reached from any other using traversals based on greatest common divisors.
和等于目标值的质数对
Find all prime number pairs that sum up to a given integer n using an efficient sieve-based array approach.
完全子集的最大元素和
Given a 1-indexed array, select a subset where indices' product is a perfect square, then return the maximum sum.
循环移位后的矩阵相似检查
Determine if a matrix returns to its original state after performing cyclic row shifts k times using array and math patt…
统计感冒序列的数目
Calculate all valid infection sequences in a line by using array positions and combinatorial math efficiently for n peop…
双模幂运算
Solve the Double Modular Exponentiation problem by applying array manipulation and modular arithmetic to find good indic…
三角形类型
Determine the type of triangle from a three-element array using side sums and equality checks efficiently in constant ti…
人员站位的方案数 I
Calculate how many valid pairs of points can be formed on a 2D plane using array and math enumeration techniques efficie…
人员站位的方案数 II
Calculate all valid placements of people on a 2D grid ensuring Alice can fence herself with Bob without enclosing others…
求交集区域内的最大正方形面积
Find the largest square area that can fit inside the intersection of two or more rectangles in a 2D plane.
求出加密整数的和
Compute the sum of encrypted integers by replacing each digit with the largest digit, combining array traversal with dig…
交替子数组计数
Count all alternating subarrays in a binary array efficiently using array patterns and simple mathematical reasoning.
最小化曼哈顿距离
Compute the minimum maximum Manhattan distance by removing one point using array math and geometry insights efficiently.
质数的最大距离
Calculate the largest index gap between prime numbers in an array using array traversal and number theory insights effic…
K 秒后第 N 个元素的值
Solve for the N-th value after K seconds by simulating array updates and using prefix sum techniques.
使所有元素都可以被 3 整除的最少操作数
Find the minimum number of operations to make all elements in an array divisible by three.
判断是否可以赢得数字游戏
Determine if Alice can guarantee a win in a game by selectively summing single or double-digit numbers from an array.
统计不是特殊数字的数字数量
Count the numbers between two integers that are not special, where special numbers are squares of primes.
判断矩形的两个角落是否可达
Determine if there is a valid path from the bottom-left to top-right of a rectangle while avoiding circles.
K 次乘运算后的最终数组 I
Solve the problem of determining the final state of an array after multiple multiplication operations using a priority q…
吃掉所有兵需要的最多移动次数
Calculate the maximum number of moves to eliminate all pawns using BFS, bitmasking, and precise array position math effi…
替换为数位和以后的最小元素
Replace each number with its digit sum and return the smallest resulting value, using array plus math techniques efficie…
数组的最大因子得分
Calculate the maximum factor score of an integer array by optionally removing one element using LCM and GCD computations…
用点构造面积最大的矩形 I
Find the maximum area of a rectangle formed by given points on a plane with unique coordinates.
用点构造面积最大的矩形 II
Find the largest rectangle on a plane using given points while avoiding any interior points and optimizing with math and…
统计元素和差值为偶数的分区方案
Count the number of partitions with an even sum difference from an array of integers.
统计用户被提及情况
Calculate how many times each user is mentioned across MESSAGE events, accounting for offline and online statuses effici…
可行数组的数目
Find the number of possible arrays by leveraging bounds and math in this array-based problem.
全排列 IV
Find the k-th alternating permutation of numbers 1 to n, ensuring no adjacent numbers share parity, using array and math…
使数组元素都变为零的最少操作次数
Minimize operations to reduce array elements to zero, focusing on array manipulation, math, and bit operations for effic…
使数组和能被 K 整除的最少操作次数
This problem asks you to find the minimum operations to make the sum of an array divisible by a given integer k.
不同 XOR 三元组的数目 I
Calculate all unique XOR triplet values in a permutation array using array traversal and bit manipulation techniques eff…
不同 XOR 三元组的数目 II
Count all unique XOR results from triplets in an integer array using array traversal and bit manipulation techniques eff…
求出数组的 X 值 II
The "Find X Value of Array II" problem requires calculating the number of ways to remove a suffix from an array such tha…
数位和等于下标的最小下标
Find the smallest index in an array where the sum of the digits equals the index.
分割数组后不同质数的最大数目
Compute the maximum number of distinct prime numbers after sequentially updating array elements with efficient preproces…
最大子数组 GCD 分数
Maximize Subarray GCD Score focuses on maximizing a subarray's score by using at most k doubling operations on an array …
统计计算机解锁顺序排列数
Calculate the total valid unlocking sequences for computers based on their complexity using array and combinatorics logi…
根据质数下标分割数组
Split Array by Prime Indices challenges you to separate elements at prime positions and minimize the absolute sum differ…