题库chevron_right分类chevron_right数学
calculate

数学

528 道题目
简单: 142中等: 243困难: 143

数学 是技术面试里最常出现的能力维度之一。建议先掌握基础题型的边界处理,再逐步过渡到模式识别和复杂度 trade-off。

面试场景

高频考察问题建模、边界条件与口头表达的清晰度。

常见误区

只背模板不解释为什么,容易在追问里失分。

练习策略

每轮练 3-5 题,固定复盘复杂度和可替代解法。

推荐练习顺序

#题目难度
2

两数相加

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

中等
7

整数反转

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

中等
9

回文数

Determine if a given integer reads the same forward and backward using a math-driven solution strategy without convertin…

简单
12

整数转罗马数字

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

中等
13

罗马数字转整数

Convert a Roman numeral string into an integer using a hash table and mathematical principles to determine value order.

简单
29

两数相除

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

中等
43

字符串相乘

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

中等
48

旋转图像

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

中等
50

Pow(x, n)

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

中等
60

排列序列

Find the kth permutation sequence of a set of numbers using math and recursion to efficiently compute the result.

困难
62

不同路径

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

中等
66

加一

Given a number as an array of digits, increment it by one and return the updated array of digits.

简单
67

二进制求和

Add Binary involves summing two binary strings and returning the result as a binary string using math and string manipul…

简单
69

x 的平方根

Solve the Sqrt(x) problem using binary search to find the integer square root of a number without built-in operators.

简单
70

爬楼梯

Climbing Stairs is a classic dynamic programming problem where you calculate distinct ways to reach the top using step t…

简单
89

格雷编码

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

中等
96

不同的二叉搜索树

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

中等
149

直线上最多的点数

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

困难
150

逆波兰表达式求值

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

中等
166

分数到小数

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

中等
168

Excel 表列名称

Convert a positive integer to its corresponding Excel column title using base-26 math and string manipulation efficientl…

简单
171

Excel 表列序号

This problem requires converting an Excel column title into its corresponding column number by applying a math and strin…

简单
172

阶乘后的零

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

中等
189

轮转数组

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

中等
202

快乐数

Determine if a number is happy by repeatedly summing squares of digits using two-pointer scanning to detect cycles effic…

简单
204

计数质数

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

中等
223

矩形面积

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

中等
224

基本计算器

Implement a basic calculator to evaluate mathematical expressions, ensuring correct evaluation with stack-based manageme…

困难
227

基本计算器 II

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

中等
231

2 的幂

Determine if a given integer is a power of two using efficient math and bit manipulation techniques with optional recurs…

简单
233

数字 1 的个数

Compute the total number of digit one appearing in all numbers from 0 up to n using state transition dynamic programming…

困难
241

为运算表达式设计优先级

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

中等
258

各位相加

Add Digits involves repeatedly summing digits of a number until a single digit is obtained.

简单
263

丑数

The Ugly Number problem asks you to determine if a number is divisible only by 2, 3, or 5.

简单
264

丑数 II

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

中等
268

丢失的数字

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

简单
273

整数转换英文表示

Convert a given integer to its English words representation using mathematical logic and string manipulation.

困难
279

完全平方数

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

中等
282

给表达式添加运算符

Expression Add Operators is solved with backtracking that builds multi-digit operands and tracks multiplication preceden…

困难
292

Nim 游戏

In Nim Game, determine if you can win given a certain number of stones, assuming optimal play from both players.

简单
313

超级丑数

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

中等
319

灯泡开关

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

中等
326

3 的幂

Determine if a given integer is a power of three using math and recursion techniques.

简单
335

路径交叉

Determine if a path defined by sequential distances on a 2D plane crosses itself using array and math reasoning.

困难
342

4的幂

Determine if a given integer is a power of four using math insights and bit manipulation tricks efficiently in code.

简单
343

整数拆分

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

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

中等
367

有效的完全平方数

Determine if a given positive integer is a perfect square using a binary search approach over potential square roots eff…

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

中等
375

猜数字大小 II

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

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

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

中等
390

消除游戏

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

中等
391

完美矩形

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

困难
396

旋转函数

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

中等
398

随机数索引

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

中等
400

第 N 位数字

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

中等
405

数字转换为十六进制数

Convert a 32-bit integer to its hexadecimal string using math operations and careful string manipulation techniques.

简单
412

Fizz Buzz

Generate a list from 1 to n replacing multiples of 3 with Fizz, 5 with Buzz, and both with FizzBuzz efficiently.

简单
415

字符串相加

Given two non-negative integers as strings, sum them and return the result as a string without converting to integers di…

简单
423

从英文中重建数字

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

中等
441

排列硬币

Determine the maximum number of complete staircase rows possible with n coins using a binary search approach.

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

中等
453

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

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

中等
458

可怜的小猪

Find the minimum number of pigs required to determine the poisonous bucket within a set time using state transition dyna…

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

中等
470

用 Rand7() 实现 Rand10()

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

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

中等
479

最大回文数乘积

Find the largest palindromic number from the product of two n-digit integers using math and enumeration efficiently.

困难
483

最小好进制

Find the smallest good base of an integer n using binary search over the valid answer space.

困难
486

预测赢家

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

中等
492

构造矩形

Given an area, design a rectangle with integer length and width optimizing L >= W and minimal difference, using math.

简单
497

非重叠矩形中的随机点

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

中等
504

七进制数

Convert any given integer to its base 7 string representation using efficient math and string manipulation techniques.

简单
507

完美数

Check if a given number is a perfect number by verifying if it's equal to the sum of its divisors, excluding itself.

简单
509

斐波那契数

Calculate the nth Fibonacci number using state transition dynamic programming and recursive techniques efficiently in in…

简单
519

随机翻转矩阵

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

中等
523

连续的子数组和

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

中等
528

按权重随机选择

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

中等
537

复数乘法

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

中等
539

最小时间差

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

中等
553

最优除法

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

中等
556

下一个更大元素 III

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

中等
564

寻找最近的回文数

Identify the nearest palindrome to a given integer string, handling ties and large numbers efficiently using math and st…

困难
587

安装栅栏

Find the perimeter fence of a garden by determining the outermost trees in a set of given tree coordinates.

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

中等
598

区间加法 II

Range Addition II requires counting maximum values in a matrix after incremental operations using array and math reasoni…

简单
628

三个数的最大乘积

Find three numbers in an array whose product is the largest using sorting and careful handling of negative values.

简单
633

平方数之和

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

中等
640

求解方程

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

中等
650

两个键的键盘

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

中等
667

优美的排列 II

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

中等
668

乘法表中第k小的数

Find the kth smallest number in an m x n multiplication table using binary search over the valid answer space.

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

中等
679

24 点游戏

Solve the 24 Game by arranging four card numbers using arithmetic operators and parentheses to reach exactly 24 efficien…

困难
710

黑名单中的随机数

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

困难
728

自除数

Identify self-dividing numbers in a given range by verifying divisibility against their digits.

简单
738

单调递增的数字

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

中等
754

到达终点数字

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

中等
762

二进制表示中质数个计算置位

Count numbers with prime set bits in a binary representation within a given range.

简单
770

基本计算器 IV

Simplify mathematical expressions using stack-based state management, handling variables, operators, and polynomial term…

困难
775

全局倒置与局部倒置

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

中等
779

第K个语法符号

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

中等
780

到达终点

Determine whether it is possible to reach a target point from a start point using repeated additive moves following stri…

困难
781

森林中的兔子

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

中等
782

变为棋盘

Determine the minimum swaps of rows or columns to convert an n x n binary board into a valid chessboard configuration.

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

中等
793

阶乘函数后 K 个零

Solve for the number of integers whose factorial ends with a specific number of zeroes using binary search techniques.

困难
805

数组的均值分割

Determine whether an integer array can be partitioned into two non-empty subarrays with the same average using dynamic p…

困难
808

分汤

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

中等
810

黑板异或游戏

The Chalkboard XOR Game is a game theory problem involving array manipulation and bitwise XOR, where players alternate e…

困难
812

最大三角形面积

Find the area of the largest triangle formed by three distinct points on a 2D plane.

简单
829

连续整数求和

Find the number of ways to express a number as the sum of consecutive positive integers.

困难
836

矩形重叠

Determine if two axis-aligned rectangles overlap based on their coordinates.

简单
837

新 21 点

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

中等
840

矩阵中的幻方

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

中等
843

猜猜这个单词

Master the Guess the Word problem by applying array manipulation, match-counting math, and strategic interactive guessin…

困难
858

镜面反射

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

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

中等
877

石子游戏

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

中等
878

第 N 个神奇数字

Find the nth magical number divisible by a or b, using binary search to efficiently handle large inputs.

困难
883

三维形体投影面积

Calculate the projection area of a 3D shape defined by a grid of towers with varying heights.

简单
887

鸡蛋掉落

Solve the Super Egg Drop problem using dynamic programming and binary search to minimize the number of moves required to…

困难
891

子序列宽度之和

Calculate the sum of widths for all subsequences in an integer array using sorting and combinatorial math efficiently.

困难
892

三维形体的表面积

Solve the Surface Area of 3D Shapes problem using array manipulation and mathematical formulas to calculate surface area…

简单
899

有序队列

Given a string and integer k, rearrange characters to achieve the lexicographically smallest string using limited rotati…

困难
902

最大为 N 的数字组合

The 'Numbers At Most N Given Digit Set' problem requires calculating how many numbers can be formed using a given digit …

困难
906

超级回文数

Count all super-palindromes in a given numeric range, where each is a palindrome and square of a palindrome.

困难
908

最小差值 I

Find the smallest score of an array after applying an operation to each element within a given range.

简单
910

最小差值 II

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

中等
913

猫和老鼠

Determine the outcome of a two-player Cat and Mouse game on a graph using topological ordering and memoized dynamic prog…

困难
914

卡牌分组

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

简单
920

播放列表的数量

Solve the Number of Music Playlists problem with dynamic programming, focusing on state transitions and combinatorics to…

困难
927

三等分

Divide a binary array into three contiguous parts such that each part represents the same integer value in binary, using…

困难
932

漂亮数组

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

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

困难
957

N 天后的牢房

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

中等
963

最小面积矩形 II

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

中等
964

表示数字的最少运算符

Compute the minimum number of arithmetic operators to form a target using repeated x with addition, subtraction, multipl…

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

中等
972

相等的有理数

Given two rational numbers as strings with possible repeating decimals, determine if they represent the same number.

困难
973

最接近原点的 K 个点

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

中等
976

三角形的最大周长

Given an integer array, find the largest perimeter of a triangle formed from three of these lengths.

简单
989

数组形式的整数加法

Compute the sum of an integer and a number represented as an array, efficiently handling digit carries and array travers…

简单
991

坏了的计算器

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

中等
996

平方数组的数目

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

困难
1006

笨阶乘

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

中等
1012

至少有 1 位重复的数字

Solve Numbers With Repeated Digits by counting unique-digit numbers up to n, then subtracting from n using digit DP.

困难
1015

可被 K 整除的最小整数

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

中等
1017

负二进制转换

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

中等
1025

除数博弈

Divisor Game is a game theory problem where players take turns subtracting divisors of a number n until one player loses…

简单
1030

距离顺序排列矩阵单元格

Compute all matrix cell coordinates sorted by Manhattan distance from a given center using array and math techniques eff…

简单
1033

移动石子直到连续

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

中等
1037

有效的回旋镖

Determine if three points on a 2D plane form a boomerang, based on distinctness and non-collinearity.

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

中等
1071

字符串的最大公因子

Find the greatest common divisor string between two strings based on the math and string patterns.

简单
1073

负二进制数相加

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

中等
1093

大样本统计

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

中等
1103

分糖果 II

Distribute candies to people in a way that follows a mathematical pattern, ensuring the distribution is correct.

简单
1104

二叉树寻路

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

中等
1131

绝对值表达式的最大值

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

中等
1137

第 N 个泰波那契数

Compute the N-th Tribonacci number using state transition dynamic programming with careful memoization and iterative upd…

简单
1140

石子游戏 II

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

中等
1154

一年中的第几天

Calculate the day number of the year based on a given Gregorian calendar date in the format YYYY-MM-DD.

简单
1175

质数排列

Calculate the number of valid permutations of 1 to n where prime numbers occupy prime indices using math-driven logic.

简单
1185

一周中的第几天

Given a date, calculate the corresponding weekday using a math-based strategy, focusing on modular arithmetic.

简单
1201

丑数 III

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

中等
1217

玩筹码

Compute the minimum cost to move all chips to one position using parity-based greedy moves efficiently.

简单
1227

飞机座位分配概率

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

中等
1232

缀点成线

Determine if a series of coordinates form a straight line on a 2D plane using geometry and mathematical principles.

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

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

中等
1250

检查「好数组」

Determine if a given array of positive integers can generate 1 using integer multiples of any subset, leveraging number …

困难
1252

奇数值单元格的数目

This problem involves updating a matrix based on given indices and counting cells with odd values afterward.

简单
1266

访问所有点的最小时间

Calculate the minimum seconds required to visit all given 2D points in order using optimal diagonal or straight moves.

简单
1276

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

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

中等
1281

整数的各位积和之差

Calculate the difference between the product and sum of an integer's digits using a simple math-driven approach for effi…

简单
1290

二进制链表转整数

Convert a binary number represented in a linked list to its decimal value using efficient pointer manipulation.

简单
1295

统计位数为偶数的数字

Count the integers in an array that have an even number of digits using a direct array traversal with digit math.

简单
1304

和为零的 N 个不同整数

Generate an array of n unique integers that sum to zero using a symmetric pairing strategy to ensure balance.

简单
1307

口算难题

Check if a verbal arithmetic equation can be solved using a valid digit-letter mapping.

困难
1317

将整数转换为两个无零整数的和

Find two positive integers whose sum equals n and neither contains the digit zero, using a direct math-driven approach.

简单
1323

6 和 9 组成的最大数字

Maximize a number by flipping at most one digit from 6 to 9 or vice versa.

简单
1330

翻转子数组得到最大的数组值

Maximize the value of an array by reversing a subarray, focusing on greedy choices and invariant validation.

困难
1342

将数字变成 0 的操作次数

Reduce a number to zero using bit manipulation and math. Simulate the process step-by-step based on whether the number i…

简单
1344

时钟指针的夹角

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

中等
1352

最后 K 个数的乘积

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

中等
1359

有效的快递序列数目

Count all valid pickup and delivery sequences for n orders where deliveries occur after pickups using dynamic programmin…

困难
1360

日期之间隔几天

Calculate the exact number of days between two dates using string parsing and arithmetic logic with consistent accuracy.

简单
1362

最接近的因数

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

中等
1363

形成三的最大倍数

Find the largest number divisible by three by selecting and ordering digits optimally using state transition dynamic pro…

困难
1390

四因数

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

中等
1399

统计最大组的数目

Count the number of groups with the largest size by summing digits of numbers from 1 to n using a hash table approach.

简单
1401

圆和矩形是否有重叠

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

中等
1406

石子游戏 III

Stone Game III is a challenging dynamic programming problem based on game theory and state transition logic.

困难
1414

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

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

中等
1432

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

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

中等
1442

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

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

中等
1447

最简分数

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

中等
1453

圆形靶内的最大飞镖数量

Maximize the number of darts on a circular dartboard given dart positions and radius.

困难
1467

两个盒子中球的颜色数相同的概率

Compute the probability that two boxes contain the same number of distinct balls using careful combinatorial and DP meth…

困难
1478

安排邮筒

Allocate k mailboxes to houses along a street minimizing total distance using dynamic programming with state transitions…

困难
1486

数组异或操作

Compute the bitwise XOR of a dynamically generated array using a combination of math and bit manipulation techniques eff…

简单
1492

n 的第 k 个因子

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

中等
1510

石子游戏 IV

Stone Game IV requires predicting the winner using state transition dynamic programming with careful consideration of pe…

困难
1512

好数对的数目

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

简单
1513

仅含 1 的子串数

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

中等
1515

服务中心的最佳位置

Find the optimal service center position in a city by minimizing the sum of Euclidean distances to all customers.

困难
1518

换水问题

Maximize the number of water bottles you can drink by simulating the exchange process between full and empty bottles.

简单
1523

在区间范围内统计奇数数目

Count Odd Numbers in an Interval Range efficiently using a math-driven formula that avoids unnecessary iteration over la…

简单
1524

和为奇数的子数组数目

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

中等
1551

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

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

中等
1561

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

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

中等
1563

石子游戏 V

In Stone Game V, Alice divides stones into rows to maximize her score, using a dynamic programming approach to try all d…

困难
1569

将子数组重新排序得到同一个二叉搜索树的方案数

Determine the number of ways to reorder an array to get the same binary search tree (BST) from its insertion order.

困难
1573

分割字符串的方案数

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

中等
1577

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

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

中等
1588

所有奇数长度子数组的和

Calculate the sum of all odd-length subarrays in a given integer array using efficient array and math strategies.

简单
1610

可见点的最大数目

Determine the maximum number of points visible from a fixed location within a given angle using a sliding window approac…

困难
1621

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

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

中等
1622

奇妙序列

Implement a Fancy sequence supporting append, addAll, and multAll operations efficiently using cumulative math design te…

困难
1627

带阈值的图连通性

In 'Graph Connectivity With Threshold,' determine if cities are connected based on common divisors exceeding a threshold…

困难
1641

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

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

中等
1643

第 K 条最小指令

Find the kth smallest lexicographic instruction sequence for reaching a destination in a grid using state transition dyn…

困难
1648

销售价值减少的颜色球

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

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

中等
1688

比赛中的配对次数

Calculate the total matches in a tournament by simulating rounds and applying simple math rules for advancing teams.

简单
1690

石子游戏 VII

Maximize score difference in a two-player turn-based stone removal game using state transition dynamic programming.

中等
1716

计算力扣银行的钱

Calculate the total amount of money in the Leetcode bank at the end of the nth day, based on a weekly increasing deposit…

简单
1728

猫和老鼠 II

Cat and Mouse II requires determining if the mouse can reach food before being caught using graph and topological orderi…

困难
1735

生成乘积数组的方案数

Determine the number of arrays of size n where the product equals k using prime factorization and combinatorial DP techn…

困难
1739

放置盒子

Optimize the number of boxes touching the floor in a cubic room using binary search to minimize floor occupancy.

困难
1742

盒子中小球的最大数量

The problem asks you to find the box with the maximum number of balls based on the sum of digits of ball numbers.

简单
1753

移除石子的最大得分

Maximize the score in a solitaire game by optimally removing stones from three piles with a greedy approach.

中等
1759

统计同质子字符串的数目

This problem requires counting all homogenous substrings in a given string and returning the result modulo 10^9 + 7.

中等
1766

互质树

Determine the closest coprime ancestor for each node in a tree using efficient traversal and state tracking of node valu…

困难
1776

车队 II

Car Fleet II involves calculating collision times between cars traveling at different speeds along a one-lane road using…

困难
1780

判断一个数字是否可以表示成三的幂的和

Determine if a number can be expressed as the sum of distinct powers of three using a math-driven strategy.

中等
1799

N 次操作后的最大分数和

Maximize the score after n operations by selecting pairs from the array and using their GCD with dynamic programming or …

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

中等
1808

好因子的最大数目

Solve Maximize Number of Nice Divisors by splitting primeFactors into mostly 3s and using fast modular exponentiation.

困难
1812

判断国际象棋棋盘中一个格子的颜色

Determine whether a given chessboard square is white or black by converting coordinates using a math plus string approac…

简单
1814

统计一个数组中好对子的数目

Count Nice Pairs in an Array requires efficiently pairing numbers where nums[i] + rev(nums[j]) equals nums[j] + rev(nums…

中等
1819

序列中不同最大公约数的数目

Given an array of positive integers, find the number of different subsequences' GCDs.

困难
1822

数组元素积的符号

Determine the sign of a product from an integer array using a single pass without computing the full product.

简单
1823

找出游戏的获胜者

Find the winner of a circular game by simulating the elimination process with a queue-driven approach.

中等
1828

统计一个圆中点的数目

Determine how many 2D points lie within multiple circles using array iteration and Euclidean distance calculations effic…

中等
1830

使字符串有序的最少操作次数

Calculate the minimum operations to sort a string using combinatorial math and string manipulation techniques efficientl…

困难
1835

所有数对按位与结果的异或和

Compute the XOR sum of all pairwise ANDs between two integer arrays using array and bitwise math techniques efficiently.

困难
1837

K 进制表示下的各位数字总和

Calculate the sum of digits of a number after converting it from base 10 to any given base using a math-driven approach.

简单
1840

最高建筑高度

Find the maximum building height in a city given height restrictions for specific buildings.

困难
1860

增长的内存泄露

Solve Incremental Memory Leak by simulating each second carefully and using math to reason about the crash time bound.

中等
1862

向下取整数对和

The problem asks to calculate the sum of floor divisions for all pairs in a given integer array, using an efficient meth…

困难
1863

找出所有子集的异或总和再求和

Compute the sum of all subset XOR totals using a backtracking search with pruning for arrays of small size.

简单
1866

恰有 K 根木棍可以看到的排列数目

Calculate the number of arrangements of n uniquely-sized sticks so exactly k sticks are visible using dynamic programmin…

困难
1872

石子游戏 VIII

Stone Game VIII requires calculating maximum score difference using state transition dynamic programming on prefix sums …

困难
1878

矩阵中最大的三个菱形和

Find the three largest distinct rhombus sums from a given grid using array and math techniques.

中等
1884

鸡蛋掉落-两枚鸡蛋

Determine the minimum drops needed to find the critical floor using 2 eggs with optimized state transition dynamic progr…

中等
1896

反转表达式值的最少操作次数

Determine the minimum operations to change a boolean expression's result using state transition dynamic programming effi…

困难
1903

字符串中的最大奇数

Find the largest odd number in a string using a greedy approach with careful digit inspection and invariant checks.

简单
1904

你完成的完整对局数

Solve this math plus string problem to calculate the number of full rounds played in a chess tournament between login an…

中等
1916

统计为蚁群构筑房间的不同顺序

Solve the problem of counting distinct ways to build rooms in an ant colony using dynamic programming and topological or…

困难
1922

统计好数字的数目

Count Good Numbers uses a mathematical pattern with recursion to efficiently count digit strings of length n under stric…

中等
1925

统计平方和三元组的数目

Count Square Sum Triples asks to find the number of integer triples where a² + b² = c² for values between 1 and n.

简单
1927

求和游戏

Determine if Alice can force a win in the Sum Game by strategically replacing '?' using a greedy and invariant approach.

中等
1952

三除数

Determine if a given integer has exactly three positive divisors.

简单
1954

收集足够苹果的最小花园周长

Find the minimum perimeter of a square garden that holds enough apples based on a specific formula involving binary sear…

中等
1969

数组元素的最小非零乘积

The problem asks to minimize the product of an array after performing bit-swapping operations on its binary representati…

中等
1979

找出数组的最大公约数

Find the greatest common divisor of the smallest and largest numbers in an integer array.

简单
1994

好子集的数目

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

困难
1998

数组的最大公因数排序

The GCD Sort problem challenges you to sort an array using a specific gcd-based swap method.

困难
2001

可互换矩形的组数

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

中等
2019

解出数学表达式的学生分数

Calculate student scores for a single-digit math expression using state transition dynamic programming to track all vali…

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

中等
2038

如果相邻两个颜色均相同则删除当前颜色

Alice and Bob play a game removing colored pieces; Alice wins if she makes the last valid move.

中等
2048

下一个更大的数值平衡数

Find the smallest numerically balanced number greater than a given integer using backtracking search and pruning.

中等
2063

所有子字符串中的元音

Compute the total number of vowels in all substrings of a given string using efficient state transition dynamic programm…

中等
2081

k 镜像数字的和

This problem requires finding the sum of the n smallest k-mirror numbers by generating palindromes in base-k and base-10…

困难
2101

引爆最多的炸弹

Determine the maximum number of bombs that can be detonated by leveraging chain reactions using graph traversal and DFS …

中等
2110

股票平滑下跌阶段的数目

Count all contiguous periods where stock prices descend smoothly by exactly one using dynamic programming techniques.

中等
2117

一个区间内所有数乘积的缩写

Calculate the abbreviated product of integers in a range efficiently using math-driven analysis of trailing zeros and si…

困难
2119

反转两次的数字

Determine if reversing a number twice returns the original integer by analyzing trailing zeros and digit placement.

简单
2125

银行中的激光束数量

Calculate total laser beams in a bank floor plan using array counting and math logic between security devices on differe…

中等
2139

得到目标值的最少行动次数

Calculate the fewest steps to reach a target integer using increments and limited doubles with a greedy strategy.

中等
2147

分隔长廊的方案数

Calculate the number of ways to split a corridor into sections with exactly two seats using dynamic programming efficien…

困难
2160

拆分数位后四位数字的最小和

Find the minimum sum of two 2-digit numbers by splitting a four-digit number into two integers.

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

中等
2169

得到 0 的操作数

Simulate operations on two integers until one becomes zero, counting how many steps it takes to achieve the result.

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

中等
2180

统计各位数字之和为偶数的整数个数

Solve this Easy Math plus Simulation problem by counting numbers whose digit sums are even up to a given limit efficient…

简单
2183

统计可以被 K 整除的下标对数目

Count Array Pairs Divisible by K requires counting index pairs whose products are divisible by a given number k.

困难
2195

向数组中追加 K 个整数

In this problem, you need to append k unique positive integers to a given array nums such that the sum is minimized.

中等
2197

替换数组中的非互质数

Replace Non-Coprime Numbers in Array uses stack-based state management to iteratively merge adjacent non-coprime integer…

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

中等
2235

两整数相加

This problem asks to return the sum of two integers within a specific range, focusing on math-driven solution strategy.

简单
2240

买钢笔和铅笔的方案数

Calculate all distinct ways to spend a fixed total on pens and pencils using a straightforward enumeration strategy.

中等
2249

统计圆内格点数目

Count the number of lattice points inside at least one circle in a grid, based on given center and radius data.

中等
2266

统计打字方案数

Calculate the total number of possible original texts from a pressed key sequence using state transition dynamic program…

中等
2269

找到一个数字的 K 美丽值

Calculate the k-beauty of a number by counting substrings of length k that divide the original number evenly using a sli…

简单
2280

表示一个折线图的最少线段数

Determine the fewest lines needed to accurately connect stock price points in a line chart using array and math reasonin…

中等
2310

个位数字为 K 的整数之和

Determine the minimum set of positive integers whose units digits match k and sum exactly to num using DP patterns.

中等
2317

操作后的最大异或和

Maximize the bitwise XOR of an array after applying a special operation with non-negative integers multiple times.

中等
2338

统计理想数组的数目

This problem involves counting the number of ideal arrays of a given length under certain conditions using state transit…

困难
2344

使数组可以被整除的最少删除次数

Find the minimum number of deletions to make the smallest element in nums divide all elements of numsDivide.

困难
2348

全 0 子数组的数目

Given an array of integers, count the subarrays that consist entirely of 0s.

中等
2358

分组的最大数量

Determine the maximum number of ordered non-empty student groups for a competition using grades array analysis and binar…

中等
2364

统计坏数对的数目

Count the number of bad pairs in an array where the difference between indices and values does not match.

中等
2366

将数组排序的最少替换次数

Minimize the number of operations to make the array sorted in non-decreasing order by replacing elements with sums of tw…

困难
2376

统计特殊整数

Count the number of special integers in the interval [1, n] where digits of each integer are distinct.

困难
2396

严格回文的数字

Determine if a number is strictly palindromic in all bases from 2 to n minus 2 using two-pointer scanning and invariant …

中等
2400

恰好移动 k 步到达某一位置的方法数目

Find the number of ways to reach a position after exactly k steps on an infinite number line using dynamic programming.

中等
2409

统计共同度过的日子数

Count the total number of days Alice and Bob are in Rome together, given their arrival and departure dates.

简单
2413

最小偶倍数

Find the smallest even multiple of a given integer using math and number theory concepts efficiently.

简单
2427

公因子的数目

The problem asks to find the number of common factors of two positive integers a and b.

简单
2440

创建价值相同的连通块

Maximize the number of components in a tree with equal sums by carefully deleting edges using divisor-based logic.

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

中等
2455

可被三整除的偶数的平均值

Find the average of even numbers divisible by 3 from an array of positive integers.

简单
2457

美丽整数的最小增量

Find the minimum addition to a number such that its digits sum to a value less than or equal to a given target.

中等
2469

温度转换

Convert the given Celsius temperature to Kelvin and Fahrenheit using mathematical formulas and return the result in an 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.

中等
2481

分割圆的最少切割次数

Calculate the fewest cuts required to divide a circle into n equal slices using math and geometric reasoning efficiently…

简单
2485

找出中枢整数

Find the Pivot Integer problem challenges you to identify an integer x that balances prefix sums on both sides.

简单
2507

使用质因数之和替换后可以取到的最小值

Replace a number with the sum of its prime factors until it stabilizes, and return the smallest value.

中等
2513

最小化两个数组中的最大值

Minimize the Maximum of Two Arrays requires finding the smallest possible maximum number across two arrays, using binary…

中等
2514

统计同位异构字符串数目

Learn to count distinct anagrams for a multi-word string using hash tables, math, and combinatorics efficiently.

困难
2520

统计能整除数字的位数

Count the digits that divide a number by checking each digit's divisibility.

简单
2521

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

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

中等
2523

范围内最接近的两个质数

Find the two closest prime numbers within a given range using efficient number theory techniques and gap comparisons.

中等
2525

根据规则将箱子分类

Classify a box as "Heavy", "Bulky", or "Neither" based on its dimensions and mass using math-driven strategies.

简单
2527

查询数组异或美丽值

Find the xor-beauty of an array by XORing the effective values of all possible triplets of indices.

中等
2535

数组元素和与数字和的绝对差

Find the absolute difference between element sum and digit sum of an array of integers.

简单
2541

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

Calculate the minimum operations to make two integer arrays equal using greedy adjustments with modular checks efficient…

中等
2543

判断一个点是否可以到达

Determine if a target point is reachable from (1,1) using math-based moves following number theory rules efficiently.

困难
2544

交替数字和

Compute the alternating digit sum by applying a sign to each digit and summing efficiently using a math-driven approach.

简单
2549

统计桌面上的不同数字

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

简单
2550

猴子碰撞的方法数

Calculate the total number of monkey collisions on a convex polygon using math and recursion efficiently for large n.

中等
2566

替换一个数字后的最大差值

Find the largest difference by remapping a single digit in a number using a greedy approach to maximize and minimize out…

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

中等
2578

最小和分割

Split a positive integer into two parts to minimize their sum using a greedy approach and sorting.

简单
2579

统计染色格子数

The "Count Total Number of Colored Cells" problem requires deriving a formula to compute colored cells based on elapsed …

中等
2582

递枕头

Pass the Pillow simulates the process of passing an item through a line of people, adjusting the direction based on time…

简单
2584

分割数组使乘积互质

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

困难
2591

将钱分给最多的儿童

Determine the maximum number of children who can each receive exactly 8 dollars using a greedy approach with validation …

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

中等
2600

K 件物品的最大和

Select k items from a bag containing 1, 0, and -1 to maximize sum using greedy choice and invariant validation strategie…

简单
2601

质数减法运算

Determine if it's possible to make the array strictly increasing using prime subtractions.

中等
2607

使子数组元素和相等

Solve Make K-Subarray Sums Equal by grouping circular indices with gcd cycles and minimizing each group to its median.

中等
2614

对角线上的质数

Find the largest prime number located on any diagonal of a square matrix using array iteration and prime checking techni…

简单
2651

计算列车到站时间

Calculate the new arrival time of a delayed train in 24-hour format by using basic math operations.

简单
2652

倍数求和

Find the sum of integers divisible by 3, 5, or 7 in the range [1, n].

简单
2654

使数组所有元素变成 1 的最少操作次数

Find the minimum number of operations to transform every element of a positive integer array into 1 using gcd operations…

中等
2681

英雄的力量

Calculate the total power of all non-empty hero groups using state transition dynamic programming efficiently with sorti…

困难
2698

求一个整数的惩罚数

Find the punishment number of a given integer using backtracking search with pruning.

中等
2709

最大公约数遍历

Determine if every index in an array can be reached from any other using traversals based on greatest common divisors.

困难
2719

统计整数数目

Count of Integers challenges you to find the number of integers with a digit sum between a given range using dynamic pro…

困难
2729

判断一个数是否迷人

Determine if a 3-digit number is fascinating by checking if the concatenated result of n, 2*n, and 3*n contains all digi…

简单
2739

总行驶距离

Calculate the maximum distance a truck can travel using main and additional fuel tanks with controlled transfers.

简单
2745

构造最长的新字符串

Maximize the length of a string built from AA, BB, and AB without creating triple repeats using DP and greedy logic.

中等
2748

美丽下标对的数目

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

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

中等
2769

找出最大的可达成数字

Determine the largest number achievable by repeatedly applying a simple math operation up to t times efficiently.

简单
2790

长度递增组的最大数目

Maximize the number of groups that can be formed with given usage limits, leveraging binary search for optimal solutions…

困难
2806

取整购买后的账户余额

Given a purchase amount, calculate the account balance after rounding the purchase to the nearest multiple of 10 and ded…

简单
2807

在链表中插入最大公约数

The problem involves inserting greatest common divisors between adjacent nodes in a linked list.

中等
2816

翻倍以链表形式表示的数字

Double a number represented as a linked list by carefully managing node values and carries with pointer traversal techni…

中等
2818

操作使得分最大

Maximize the score by applying operations on a subarray at most k times, utilizing stack-based state management.

困难
2827

范围中美丽整数的数目

Count all integers in a given range that have equal even and odd digits and are divisible by k using DP.

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

中等
2834

找出美丽数组的最小和

Find the minimum possible sum of a beautiful array that satisfies the given conditions with the greedy approach.

中等
2842

统计一个字符串的 k 子序列美丽值最大的数目

Determine the number of k-length unique subsequences in a string that maximize the sum of character frequencies efficien…

困难
2843

统计对称整数的数目

Count Symmetric Integers finds numbers where the sum of the first half of digits equals the sum of the second half withi…

简单
2844

生成特殊数字的最少操作

Minimize operations to make a number divisible by 25 by deleting digits. Use greedy choice and invariant validation.

中等
2849

判断能否在给定时间到达单元格

The problem asks if a target cell can be reached from a starting position within a given time on a 2D grid.

中等
2851

字符串转换

Find how many ways string s can be transformed into string t in exactly k operations using suffix rotations.

困难
2862

完全子集的最大元素和

Given a 1-indexed array, select a subset where indices' product is a perfect square, then return the maximum sum.

困难
2864

最大二进制奇数

Rearrange a binary string to form the largest odd binary number using a greedy approach and least significant bit valida…

简单
2867

统计树中的合法路径数目

Count Valid Paths in a Tree involves finding paths with exactly one prime number in a tree of n nodes.

困难
2894

分类求和并作差

Compute the difference between sums of integers divisible and non-divisible by m using a direct arithmetic approach effi…

简单
2928

给小朋友们分糖果 I

Given two integers n and limit, find the number of ways to distribute n candies among 3 children, with no child receivin…

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

中等
2939

最大异或乘积

Find the maximum value of (a XOR x) * (b XOR x) using greedy bitwise choices and invariant validation.

中等
2946

循环移位后的矩阵相似检查

Determine if a matrix returns to its original state after performing cyclic row shifts k times using array and math patt…

简单
2947

统计美丽子字符串 I

Given a string and a value k, count the number of beautiful substrings where vowels * consonants % k == 0.

中等
2949

统计美丽子字符串 II

Count Beautiful Substrings II focuses on finding beautiful substrings with hash tables and number theory techniques.

困难
2954

统计感冒序列的数目

Calculate all valid infection sequences in a line by using array positions and combinatorial math efficiently for n peop…

困难
2961

双模幂运算

Solve the Double Modular Exponentiation problem by applying array manipulation and modular arithmetic to find good indic…

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

简单
2967

使数组成为等数数组的最小代价

Determine the minimum cost to convert an integer array into a palindromic array using allowed element modifications effi…

中等
2999

统计强大整数的数目

Count the number of powerful integers in a given range by applying state transition dynamic programming with constraints…

困难
3001

捕获黑皇后需要的最少移动次数

Determine the fewest moves to capture the black queen using only white pieces with careful position analysis.

中等
3012

通过操作使数组长度最小

Minimize the length of an integer array through a series of operations, using a greedy approach with modular arithmetic.

中等
3014

输入单词需要的最少按键次数 I

Calculate the minimum pushes to type a word using a remapped telephone keypad with greedy allocation of letters.

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

中等
3024

三角形类型

Determine the type of triangle from a three-element array using side sums and equality checks efficiently in constant ti…

简单
3025

人员站位的方案数 I

Calculate how many valid pairs of points can be formed on a 2D plane using array and math enumeration techniques efficie…

中等
3027

人员站位的方案数 II

Calculate all valid placements of people on a 2D grid ensuring Alice can fence herself with Bob without enclosing others…

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

中等
3079

求出加密整数的和

Compute the sum of encrypted integers by replacing each digit with the largest digit, combining array traversal with dig…

简单
3084

统计以给定字符开头和结尾的子字符串总数

Given a string and a character, find the total number of substrings that start and end with that character.

中等
3091

执行操作使数据元素之和大于等于 K

Given an array nums, find the minimum number of operations to make the sum of elements greater than or equal to k.

中等
3099

哈沙德数

Given an integer, determine if it is a Harshad number by checking if it's divisible by the sum of its digits.

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

中等
3102

最小化曼哈顿距离

Compute the minimum maximum Manhattan distance by removing one point using array math and geometry insights efficiently.

困难
3115

质数的最大距离

Calculate the largest index gap between prime numbers in an array using array traversal and number theory insights effic…

中等
3116

单面值组合的第 K 小金额

Find the kth smallest amount using only one coin denomination at a time, applying binary search efficiently over possibl…

困难
3128

直角三角形

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

中等
3153

所有数对中数位差之和

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

中等
3154

到达第 K 级台阶的方案数

Determine the total number of ways to reach the k-th stair using a state transition dynamic programming approach with co…

困难
3178

找出 K 秒后拿着球的孩子

Find the child who holds the ball after k seconds of passing in a queue, considering reversals at both ends.

简单
3179

K 秒后第 N 个元素的值

Solve for the N-th value after K seconds by simulating array updates and using prefix sum techniques.

中等
3190

使所有元素都可以被 3 整除的最少操作数

Find the minimum number of operations to make all elements in an array divisible by three.

简单
3222

求出硬币游戏的赢家

In this game between Alice and Bob, players must pick coins summing to 115. Alice starts, and the goal is to determine t…

简单
3227

字符串元音游戏

Solve the Vowels Game in a String using optimal moves and string analysis to predict the winner efficiently and accurate…

中等
3232

判断是否可以赢得数字游戏

Determine if Alice can guarantee a win in a game by selectively summing single or double-digit numbers from an array.

简单
3233

统计不是特殊数字的数字数量

Count the numbers between two integers that are not special, where special numbers are squares of primes.

中等
3235

判断矩形的两个角落是否可达

Determine if there is a valid path from the bottom-left to top-right of a rectangle while avoiding circles.

困难
3250

单调数组对的数目 I

Compute the number of monotonic pairs in an integer array using state transition dynamic programming efficiently.

困难
3251

单调数组对的数目 II

This problem involves finding the count of monotonic pairs in an array using dynamic programming and combinatorics techn…

困难
3260

找出最大的 N 位 K 回文数

Compute the largest n-digit integer divisible by k that forms a palindrome using state transition dynamic programming te…

困难
3264

K 次乘运算后的最终数组 I

Solve the problem of determining the final state of an array after multiple multiplication operations using a priority q…

简单
3270

求出数字答案

Determine the four-digit key from three given numbers using a precise math-driven approach for exact digit alignment.

简单
3272

统计好整数的数目

Count good integers by rearranging digits to form k-palindromic numbers, leveraging hash tables and math techniques.

困难
3274

检查棋盘方格颜色是否相同

Determine if two chessboard squares share the same color using coordinate math and simple string manipulation for quick …

简单
3280

将日期转换为二进制表示

Convert a given Gregorian date string to its binary format by transforming year, month, and day individually without lea…

简单
3283

吃掉所有兵需要的最多移动次数

Calculate the maximum number of moves to eliminate all pawns using BFS, bitmasking, and precise array position math effi…

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

简单
3296

移山所需的最少秒数

Determine the minimum seconds required to reduce a mountain to zero height using simultaneous workers efficiently.

中等
3300

替换为数位和以后的最小元素

Replace each number with its digit sum and return the smallest resulting value, using array plus math techniques efficie…

简单
3304

找出第 K 个字符 I

Find the K-th character in a progressively built string using math and bit manipulation efficiently.

简单
3307

找出第 K 个字符 II

Find the K-th character in a string game using bit manipulation and recursion, optimizing performance for large k values…

困难
3312

查询排序后的最大公约数

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

困难
3317

安排活动的方案数

Given n performers, x stages, and y scores, calculate the number of possible ways to assign performers and score bands.

困难
3326

使数组非递减的最少除法操作次数

Determine the minimum number of division operations to make an array non-decreasing using a greedy and invariant-based s…

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

中等
3336

最大公约数相等的子序列数量

Count all pairs of non-empty subsequences in an integer array whose elements share the same greatest common divisor effi…

困难
3337

字符串转换后的长度 II

Calculate the length of a string after repeated transformations using state transition dynamic programming for large t v…

困难
3343

统计平衡排列的数目

Determine how many distinct permutations of a digit string are balanced using state transition dynamic programming effic…

困难
3345

最小可整除数位乘积 I

Find the smallest number greater than or equal to n whose digit product is divisible by t.

简单
3348

最小可整除数位乘积 II

Find the smallest zero-free number at least as large as num whose digits multiply to a product divisible by t using care…

困难
3352

统计小于 N 的 K 可约简整数

This problem challenges you to count the K-reducible numbers less than a given binary integer using dynamic programming.

困难
3360

移除石头游戏

Alice and Bob play a game of stone removal. Alice goes first, and the winner is the player who can make a move until the…

简单
3370

仅含置位位的最小整数

Find the smallest number greater than or equal to n with all set bits in its binary representation.

简单
3377

使两个整数相等的数位操作

Transform n into m using allowed digit operations without creating primes, applying math and graph strategies efficientl…

中等
3378

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

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

困难
3380

用点构造面积最大的矩形 I

Find the maximum area of a rectangle formed by given points on a plane with unique coordinates.

中等
3382

用点构造面积最大的矩形 II

Find the largest rectangle on a plane using given points while avoiding any interior points and optimizing with math and…

困难
3395

唯一中间众数子序列 I

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

困难
3404

统计特殊子序列的数目

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

中等
3405

统计恰好有 K 个相等相邻元素的数组数目

Count the number of valid arrays with exactly k adjacent elements that are equal, using math and combinatorics technique…

困难
3411

最长乘积等价子数组

This problem involves finding the longest subarray where the product equals the LCM multiplied by the GCD, leveraging a …

简单
3426

所有安放棋子方案的曼哈顿距离

This problem challenges you to calculate Manhattan distances in all valid arrangements of identical pieces on a grid.

困难
3428

最多 K 个元素的子序列的最值之和

Find the sum of the maximum and minimum elements of subsequences with at most k elements, using dynamic programming.

中等
3430

最多 K 个元素的子数组的最值之和

Compute the sum of maximum and minimum values in all subarrays up to size k using efficient stack-based state management…

困难
3432

统计元素和差值为偶数的分区方案

Count the number of partitions with an even sum difference from an array of integers.

简单
3433

统计用户被提及情况

Calculate how many times each user is mentioned across MESSAGE events, accounting for offline and online statuses effici…

中等
3443

K 次修改后的最大曼哈顿距离

Solve Maximum Manhattan Distance After K Changes by scanning prefixes and testing the four diagonal target pairs with li…

中等
3444

使数组包含目标值倍数的最少增量

This problem involves incrementing elements of an array to make sure each target element has at least one multiple in th…

困难
3461

判断操作后字符串中的数字是否相等 I

Simulate repeated adjacent digit sums modulo 10 until two digits remain, then check whether those final digits match.

简单
3463

判断操作后字符串中的数字是否相等 II

Determine if repeated digit-sum operations on a numeric string reduce it to two equal digits using math and string techn…

困难
3468

可行数组的数目

Find the number of possible arrays by leveraging bounds and math in this array-based problem.

中等
3470

全排列 IV

Find the k-th alternating permutation of numbers 1 to n, ensuring no adjacent numbers share parity, using array and math…

困难
3492

船上可以装载的最大集装箱数量

Determine the maximum number of containers that can be loaded onto a ship's deck without exceeding weight limits.

简单
3495

使数组元素都变为零的最少操作次数

Minimize operations to reduce array elements to zero, focusing on array manipulation, math, and bit operations for effic…

困难
3505

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

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

困难
3512

使数组和能被 K 整除的最少操作次数

This problem asks you to find the minimum operations to make the sum of an array divisible by a given integer k.

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

中等
3516

找到最近的人

Determine which of two people reaches a third person first using a simple math-driven distance comparison strategy.

简单
3518

最小回文排列 II

Find the k-th lexicographically smallest palindromic rearrangement of a given palindromic string s.

困难
3519

统计逐位非递减的整数

Count all integers between l and r whose digits never decrease in base b using state transition dynamic programming effi…

困难
3524

求出数组的 X 值 I

Determine the x-value of an array using state transition dynamic programming to count valid prefix-suffix operations eff…

中等
3525

求出数组的 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…

困难
3536

两个数字的最大乘积

Find the highest product obtainable from any two digits of a given positive integer using math and sorting techniques ef…

简单
3539

魔法序列的数组乘积之和

Use state transition dynamic programming to count magical index sequences and accumulate weighted products without enume…

困难
3550

数位和等于下标的最小下标

Find the smallest index in an array where the sum of the digits equals the index.

简单
3556

最大质数子字符串之和

Compute the sum of the three largest unique primes from all substrings using hash table plus math efficiently.

中等
3558

给边赋权值的方案数 I

Calculate the number of valid edge weight assignments in a tree using DFS and binary-tree traversal with careful state t…

中等
3559

给边赋权值的方案数 II

This problem involves assigning edge weights in a tree and calculating the cost of paths based on these weights.

困难
3560

木材运输的最小成本

Calculate the minimum cost to transport two logs using a math-driven strategy considering cutting costs and truck limits…

简单
3569

分割数组后不同质数的最大数目

Compute the maximum number of distinct prime numbers after sequentially updating array elements with efficient preproces…

困难
3574

最大子数组 GCD 分数

Maximize Subarray GCD Score focuses on maximizing a subarray's score by using at most k doubling operations on an array …

困难
3577

统计计算机解锁顺序排列数

Calculate the total valid unlocking sequences for computers based on their complexity using array and combinatorics logi…

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

中等
3591

检查元素频次是否为质数

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

简单
3602

十六进制和三十六进制转化

Solve Hexadecimal and Hexatrigesimal Conversion by converting n squared to base 16 and n cubed to base 36, then joining …

简单
3605

数组的最小稳定性因子

The problem requires finding the minimum stability factor of an array by utilizing binary search and math-based optimiza…

困难
3609

到达目标点的最小移动次数

Find the minimum number of moves to reach a target point from a start point on a 2D grid with a math-driven solution.

困难
3618

根据质数下标分割数组

Split Array by Prime Indices challenges you to separate elements at prime positions and minimize the absolute sum differ…

中等
3621

位计数深度为 K 的整数数目 I

Calculate the number of integers in a given range with a specific popcount-depth using state transition dynamic programm…

困难
3622

判断整除性

Determine if a positive integer is divisible by the sum of its digits plus their product using a math-driven strategy.

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

困难
3630

划分数组得到最大异或运算和与运算之和

Partition the array into three subsequences to maximize XOR and AND operations with a greedy approach.

困难

关联高频模式

LeetCode 数学题型题解:528题训练路线