面试场景
高频考察问题建模、边界条件与口头表达的清晰度。
常见误区
只背模板不解释为什么,容易在追问里失分。
练习策略
每轮练 3-5 题,固定复盘复杂度和可替代解法。
推荐练习顺序
两数相加
Add Two Numbers requires careful linked-list pointer manipulation to sum digits while handling carries efficiently in in…
整数反转
Reverse Integer challenges you to invert the digits of a signed 32-bit integer, handling overflow and negative values ca…
回文数
Determine if a given integer reads the same forward and backward using a math-driven solution strategy without convertin…
整数转罗马数字
Convert a given integer to its Roman numeral representation using hash table mapping and decimal place math operations e…
罗马数字转整数
Convert a Roman numeral string into an integer using a hash table and mathematical principles to determine value order.
两数相除
Solve Divide Two Integers by turning repeated subtraction into bit-shifted chunk subtraction with careful sign and overf…
字符串相乘
Multiply Strings requires simulating integer multiplication using only string operations without direct numeric conversi…
旋转图像
Rotate an n x n matrix 90 degrees clockwise in-place using array manipulation and mathematical indexing techniques effic…
Pow(x, n)
Calculate x to the power n efficiently using recursion and exponentiation, handling negative powers and large inputs saf…
排列序列
Find the kth permutation sequence of a set of numbers using math and recursion to efficiently compute the result.
不同路径
Calculate the number of unique paths for a robot to move on an m x n grid with only right and down movements.
加一
Given a number as an array of digits, increment it by one and return the updated array of digits.
二进制求和
Add Binary involves summing two binary strings and returning the result as a binary string using math and string manipul…
x 的平方根
Solve the Sqrt(x) problem using binary search to find the integer square root of a number without built-in operators.
爬楼梯
Climbing Stairs is a classic dynamic programming problem where you calculate distinct ways to reach the top using step t…
格雷编码
Generate an n-bit Gray Code sequence using backtracking with pruning and bit manipulation techniques.
不同的二叉搜索树
Given n nodes, calculate the number of unique binary search trees (BSTs) that can be formed with values from 1 to n.
直线上最多的点数
Find the maximum number of points on a straight line in a 2D plane using array scanning and hash lookup.
逆波兰表达式求值
Compute the result of an arithmetic expression in Reverse Polish Notation using a stack to manage operands efficiently.
分数到小数
Convert a fraction into a decimal, handling repeating decimals with parentheses around the repeating part.
Excel 表列名称
Convert a positive integer to its corresponding Excel column title using base-26 math and string manipulation efficientl…
Excel 表列序号
This problem requires converting an Excel column title into its corresponding column number by applying a math and strin…
阶乘后的零
Given a number n, find how many trailing zeroes are in n! using a math-driven approach.
轮转数组
Rotate Array challenges you to shift elements right by k steps using precise two-pointer scanning and invariant tracking…
快乐数
Determine if a number is happy by repeatedly summing squares of digits using two-pointer scanning to detect cycles effic…
计数质数
Count all prime numbers less than a given integer n using efficient array and math-based enumeration techniques.
矩形面积
Calculate the total area covered by two rectangles using geometry, handling overlaps and avoiding double counting effici…
基本计算器
Implement a basic calculator to evaluate mathematical expressions, ensuring correct evaluation with stack-based manageme…
基本计算器 II
Basic Calculator II evaluates a mathematical expression with operators and integers, handling basic arithmetic with prec…
2 的幂
Determine if a given integer is a power of two using efficient math and bit manipulation techniques with optional recurs…
数字 1 的个数
Compute the total number of digit one appearing in all numbers from 0 up to n using state transition dynamic programming…
为运算表达式设计优先级
Solve Different Ways to Add Parentheses by splitting on each operator and memoizing every subexpression result list.
各位相加
Add Digits involves repeatedly summing digits of a number until a single digit is obtained.
丑数
The Ugly Number problem asks you to determine if a number is divisible only by 2, 3, or 5.
丑数 II
Find the nth ugly number, where ugly numbers have prime factors limited to 2, 3, and 5.
丢失的数字
Find the missing number in an array containing distinct numbers in the range [0, n].
整数转换英文表示
Convert a given integer to its English words representation using mathematical logic and string manipulation.
完全平方数
Perfect Squares asks for the least number of perfect squares summing to a given integer n using dynamic programming or B…
给表达式添加运算符
Expression Add Operators is solved with backtracking that builds multi-digit operands and tracks multiplication preceden…
Nim 游戏
In Nim Game, determine if you can win given a certain number of stones, assuming optimal play from both players.
超级丑数
Compute the nth super ugly number efficiently using dynamic programming with state transitions based on the given prime …
灯泡开关
Bulb Switcher challenges you to find how many bulbs remain on after n toggling rounds using a math-based insight.
3 的幂
Determine if a given integer is a power of three using math and recursion techniques.
路径交叉
Determine if a path defined by sequential distances on a 2D plane crosses itself using array and math reasoning.
4的幂
Determine if a given integer is a power of four using math insights and bit manipulation tricks efficiently in code.
整数拆分
Break an integer into the sum of positive integers to maximize the product using dynamic programming.
统计各位数字都不同的数字个数
The problem asks to count numbers with unique digits from 0 to 10^n using dynamic programming, math, and backtracking te…
水壶问题
Determine if two jugs with given capacities can measure an exact target amount using math and DFS strategies efficiently…
有效的完全平方数
Determine if a given positive integer is a perfect square using a binary search approach over potential square roots eff…
最大整除子集
Find the largest subset of distinct positive integers where every pair satisfies divisibility using state transition dyn…
两整数之和
Solve the Sum of Two Integers problem using bit manipulation and math to avoid using the operators + and -.
超级次方
Compute large exponentiations efficiently using modular arithmetic and divide-and-conquer techniques for this Super Pow …
猜数字大小 II
Minimize the maximum cost of guessing a number in a dynamic guessing game using optimal strategies.
O(1) 时间插入、删除和获取随机元素
Implement a data structure supporting insert, delete, and getRandom in average O(1) using array plus hash mapping.
O(1) 时间插入、删除和获取随机元素 - 允许重复
This problem challenges you to design a data structure that supports insertion, removal, and random access with O(1) tim…
链表随机节点
Select a random node from a singly linked list ensuring uniform probability using efficient pointer techniques and reser…
打乱数组
Shuffle an Array requires designing a class to randomly permute an integer array while ensuring all permutations are equ…
消除游戏
Elimination Game uses a systematic removal of numbers with alternating left-right passes, solvable with math and recursi…
完美矩形
Determine if given axis-aligned rectangles form a perfect cover using array scanning and hash-based corner counting tech…
旋转函数
Maximize the rotation function by rotating the array and calculating the weighted sum for all rotations.
随机数索引
Random Pick Index involves selecting a random index of a target number in an array with possible duplicates.
第 N 位数字
Given n, efficiently find the nth digit in the infinite integer sequence using a binary search over valid positions.
数字转换为十六进制数
Convert a 32-bit integer to its hexadecimal string using math operations and careful string manipulation techniques.
Fizz Buzz
Generate a list from 1 to n replacing multiples of 3 with Fizz, 5 with Buzz, and both with FizzBuzz efficiently.
字符串相加
Given two non-negative integers as strings, sum them and return the result as a string without converting to integers di…
从英文中重建数字
This problem asks you to reconstruct digits from an out-of-order English string using hash counting and mathematical ded…
排列硬币
Determine the maximum number of complete staircase rows possible with n coins using a binary search approach.
两数相加 II
Add Two Numbers II involves summing two numbers represented as linked lists and returning the result as a new linked lis…
回旋镖的数量
Compute all valid boomerang tuples in a point set using array scanning with hash maps to track distances efficiently.
最小操作次数使数组元素相等
Compute the fewest steps to make all elements equal by incrementing n-1 array items, applying array and math reasoning.
可怜的小猪
Find the minimum number of pigs required to determine the poisonous bucket within a set time using state transition dyna…
最小操作次数使数组元素相等 II
Find the minimum moves to equalize all array elements using increments or decrements with array and math techniques.
我能赢吗
Determine if the first player can guarantee a win in a turn-based number selection game using state transition dynamic p…
用 Rand7() 实现 Rand10()
Generate uniform random numbers from 1 to 10 using only rand7(), applying rejection sampling for consistent probability …
汉明距离总和
Calculate the total Hamming distance between all pairs in an integer array using efficient bit manipulation techniques.
在圆内随机生成点
Generate Random Point in a Circle requires creating a uniform random point inside a circle using math and geometry princ…
最大回文数乘积
Find the largest palindromic number from the product of two n-digit integers using math and enumeration efficiently.
最小好进制
Find the smallest good base of an integer n using binary search over the valid answer space.
预测赢家
Predict the Winner involves two players taking turns to maximize their score by picking from either end of an array, opt…
构造矩形
Given an area, design a rectangle with integer length and width optimizing L >= W and minimal difference, using math.
非重叠矩形中的随机点
Design an algorithm to pick random points within non-overlapping rectangles using binary search and reservoir sampling.
七进制数
Convert any given integer to its base 7 string representation using efficient math and string manipulation techniques.
完美数
Check if a given number is a perfect number by verifying if it's equal to the sum of its divisors, excluding itself.
斐波那契数
Calculate the nth Fibonacci number using state transition dynamic programming and recursive techniques efficiently in in…
随机翻转矩阵
Design an optimized algorithm to randomly flip an index in a matrix, using hash tables and math for efficient random sel…
连续的子数组和
Identify if any continuous subarray sums to a multiple of k using prefix sums and hash table tracking efficiently.
按权重随机选择
Random Pick with Weight requires implementing a probabilistic index picker using prefix sums and binary search efficient…
复数乘法
This problem requires multiplying two complex numbers, given in string form, and returning the result in the same format…
最小时间差
Calculate the smallest time difference between clock points using array manipulation and mathematical conversions effici…
最优除法
Maximize the value of an expression by optimally placing parentheses for division operations.
下一个更大元素 III
Find the next greater integer using the same digits as a given number with precise two-pointer scanning and invariant tr…
寻找最近的回文数
Identify the nearest palindrome to a given integer string, handling ties and large numbers efficiently using math and st…
安装栅栏
Find the perimeter fence of a garden by determining the outermost trees in a set of given tree coordinates.
分数加减运算
Solve fraction addition and subtraction by handling expressions, calculating results, and simplifying fractions to irred…
有效的正方形
Determine if four given 2D points form a valid square using geometric distance checks and vector validation techniques.
区间加法 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.
平方数之和
Given a non-negative integer c, determine if there are two integers whose squares sum to c.
求解方程
Solve the equation for the variable 'x' and determine its value or state if there is no solution or infinite solutions.
两个键的键盘
Minimize the number of operations to get exactly 'n' characters on the screen using two operations: Copy All and Paste.
优美的排列 II
Construct a beautiful arrangement of integers from 1 to n with k distinct integers, optimizing for time and space effici…
乘法表中第k小的数
Find the kth smallest number in an m x n multiplication table using binary search over the valid answer space.
最大交换
Given an integer, swap at most two digits once to produce the largest possible number using greedy digit selection.
灯泡开关 Ⅱ
Compute all unique bulb configurations after a fixed number of presses using math and bit manipulation efficiently.
24 点游戏
Solve the 24 Game by arranging four card numbers using arithmetic operators and parentheses to reach exactly 24 efficien…
黑名单中的随机数
Random Pick with Blacklist requires designing a method to uniformly pick integers while excluding blacklisted values eff…
自除数
Identify self-dividing numbers in a given range by verifying divisibility against their digits.
单调递增的数字
Determine the largest number less than or equal to n with digits in non-decreasing order using a greedy, invariant-drive…
到达终点数字
Determine the minimum number of moves to reach a target on an infinite number line using step increments, leveraging bin…
二进制表示中质数个计算置位
Count numbers with prime set bits in a binary representation within a given range.
基本计算器 IV
Simplify mathematical expressions using stack-based state management, handling variables, operators, and polynomial term…
全局倒置与局部倒置
Determine if every global inversion in a permutation array is also a local inversion using array and math logic efficien…
第K个语法符号
Determine the K-th symbol in a recursively generated grammar table using math and bit manipulation patterns efficiently.
到达终点
Determine whether it is possible to reach a target point from a start point using repeated additive moves following stri…
森林中的兔子
Solve Rabbits in Forest by grouping equal answers and rounding each group into the smallest valid color-class size.
变为棋盘
Determine the minimum swaps of rows or columns to convert an n x n binary board into a valid chessboard configuration.
旋转数字
Count all integers from 1 to n that transform into a different valid number when each digit is rotated 180 degrees using…
逃脱阻碍者
Escape The Ghosts tests your ability to analyze movements in an infinite grid while racing against ghost positions using…
阶乘函数后 K 个零
Solve for the number of integers whose factorial ends with a specific number of zeroes using binary search techniques.
数组的均值分割
Determine whether an integer array can be partitioned into two non-empty subarrays with the same average using dynamic p…
分汤
Compute the probability that soup A empties before soup B using state transition dynamic programming efficiently.
黑板异或游戏
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.
连续整数求和
Find the number of ways to express a number as the sum of consecutive positive integers.
矩形重叠
Determine if two axis-aligned rectangles overlap based on their coordinates.
新 21 点
Calculate the probability Alice reaches at most n points using state transition dynamic programming efficiently.
矩阵中的幻方
Scan every 3x3 window, reject invalid digits fast, then verify row, column, and diagonal sums for Magic Squares In Grid.
猜猜这个单词
Master the Guess the Word problem by applying array manipulation, match-counting math, and strategic interactive guessin…
镜面反射
Given a square room with mirrors, find which receptor a laser ray will hit first based on two integers, p and q.
回文质数
The Prime Palindrome problem asks for the smallest prime palindrome greater than or equal to a given integer.
重新排序得到 2 的幂
Determine if a number's digits can be rearranged to form a power of two using counting and hash-based checks.
石子游戏
Stone Game is a dynamic programming problem where players alternate taking stones from piles to maximize their score.
第 N 个神奇数字
Find the nth magical number divisible by a or b, using binary search to efficiently handle large inputs.
三维形体投影面积
Calculate the projection area of a 3D shape defined by a grid of towers with varying heights.
鸡蛋掉落
Solve the Super Egg Drop problem using dynamic programming and binary search to minimize the number of moves required to…
子序列宽度之和
Calculate the sum of widths for all subsequences in an integer array using sorting and combinatorial math efficiently.
三维形体的表面积
Solve the Surface Area of 3D Shapes problem using array manipulation and mathematical formulas to calculate surface area…
有序队列
Given a string and integer k, rearrange characters to achieve the lexicographically smallest string using limited rotati…
最大为 N 的数字组合
The 'Numbers At Most N Given Digit Set' problem requires calculating how many numbers can be formed using a given digit …
超级回文数
Count all super-palindromes in a given numeric range, where each is a palindrome and square of a palindrome.
最小差值 I
Find the smallest score of an array after applying an operation to each element within a given range.
最小差值 II
Determine the minimum possible difference between the largest and smallest numbers after adjusting each by plus or minus…
猫和老鼠
Determine the outcome of a two-player Cat and Mouse game on a graph using topological ordering and memoized dynamic prog…
卡牌分组
Solve the problem of determining if a deck can be partitioned into groups with equal occurrences of card values.
播放列表的数量
Solve the Number of Music Playlists problem with dynamic programming, focusing on state transitions and combinatorics to…
三等分
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 …
最小面积矩形
Find the minimum area of a rectangle formed by given points on a 2D plane with sides parallel to axes.
按公因数计算最大组件大小
Find the largest connected component in an array where edges exist between numbers sharing a common factor greater than …
N 天后的牢房
Determine the state of 8 prison cells after N days using array scanning and cycle detection for repeated patterns effici…
最小面积矩形 II
Find the minimum area rectangle from given points in the X-Y plane, with sides not necessarily parallel to the axes.
表示数字的最少运算符
Compute the minimum number of arithmetic operators to form a target using repeated x with addition, subtraction, multipl…
强整数
Find all integers that can be expressed as x^i + y^j up to a given bound using a Hash Table plus Math approach.
相等的有理数
Given two rational numbers as strings with possible repeating decimals, determine if they represent the same number.
最接近原点的 K 个点
Find the k closest points to the origin in a 2D plane using array operations and Euclidean distance calculations efficie…
三角形的最大周长
Given an integer array, find the largest perimeter of a triangle formed from three of these lengths.
数组形式的整数加法
Compute the sum of an integer and a number represented as an array, efficiently handling digit carries and array travers…
坏了的计算器
Compute the minimum operations to transform startValue into target using doubling and decrementing, leveraging a greedy …
平方数组的数目
Count the number of squareful arrays from the given list of integers by checking adjacent pairs' sums for perfect square…
笨阶乘
Compute the clumsy factorial of a number using a fixed rotation of multiply, divide, add, and subtract operations effici…
至少有 1 位重复的数字
Solve Numbers With Repeated Digits by counting unique-digit numbers up to n, then subtracting from n using digit DP.
可被 K 整除的最小整数
Find the length of the smallest positive integer divisible by k that consists only of the digit '1'.
负二进制转换
Convert any non-negative integer into its base -2 representation using a math-driven iterative remainder strategy.
除数博弈
Divisor Game is a game theory problem where players take turns subtracting divisors of a number n until one player loses…
距离顺序排列矩阵单元格
Compute all matrix cell coordinates sorted by Manhattan distance from a given center using array and math techniques eff…
移动石子直到连续
Solve the "Moving Stones Until Consecutive" problem using math and brainteaser patterns by determining the minimum and m…
有效的回旋镖
Determine if three points on a 2D plane form a boomerang, based on distinctness and non-collinearity.
移动石子直到连续 II
Determine the minimum and maximum moves to make stones consecutive using sliding window and endpoint adjustments efficie…
困于环中的机器人
Determine if a robot following a repeated instruction sequence stays within a bounded circle using math and string simul…
字符串的最大公因子
Find the greatest common divisor string between two strings based on the math and string patterns.
负二进制数相加
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.
分糖果 II
Distribute candies to people in a way that follows a mathematical pattern, ensuring the distribution is correct.
二叉树寻路
The problem involves finding the path from the root to a node in a zigzag-labelled binary tree.
绝对值表达式的最大值
Calculate the largest sum of absolute differences across two arrays and their indices using an efficient pattern-based a…
第 N 个泰波那契数
Compute the N-th Tribonacci number using state transition dynamic programming with careful memoization and iterative upd…
石子游戏 II
Stone Game II is a dynamic programming problem where Alice and Bob alternate taking stones from piles to maximize their …
一年中的第几天
Calculate the day number of the year based on a given Gregorian calendar date in the format YYYY-MM-DD.
质数排列
Calculate the number of valid permutations of 1 to n where prime numbers occupy prime indices using math-driven logic.
一周中的第几天
Given a date, calculate the corresponding weekday using a math-based strategy, focusing on modular arithmetic.
丑数 III
Find the nth positive integer divisible by a, b, or c using binary search over the answer space efficiently and accurate…
玩筹码
Compute the minimum cost to move all chips to one position using parity-based greedy moves efficiently.
飞机座位分配概率
Calculate the probability that the last passenger sits in their assigned seat using state transition dynamic programming…
缀点成线
Determine if a series of coordinates form a straight line on a 2D plane using geometry and mathematical principles.
找出给定方程的正整数解
Determine all positive integer pairs that satisfy a hidden monotonic function for a given target using binary search ove…
循环码排列
Generate a circular permutation from a range of numbers using backtracking and bit manipulation.
交换字符使得字符串相同
This problem requires determining the minimum number of swaps to make two strings equal by swapping characters between t…
统计「优美子数组」
The problem requires counting subarrays with exactly k odd numbers using an efficient array scanning approach.
检查「好数组」
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.
不浪费原料的汉堡制作方案
Determine the exact counts of jumbo and small burgers using all tomato and cheese slices without leftovers, applying mat…
整数的各位积和之差
Calculate the difference between the product and sum of an integer's digits using a simple math-driven approach for effi…
二进制链表转整数
Convert a binary number represented in a linked list to its decimal value using efficient pointer manipulation.
统计位数为偶数的数字
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.
口算难题
Check if a verbal arithmetic equation can be solved using a valid digit-letter mapping.
将整数转换为两个无零整数的和
Find two positive integers whose sum equals n and neither contains the digit zero, using a direct math-driven approach.
6 和 9 组成的最大数字
Maximize a number by flipping at most one digit from 6 to 9 or vice versa.
翻转子数组得到最大的数组值
Maximize the value of an array by reversing a subarray, focusing on greedy choices and invariant validation.
将数字变成 0 的操作次数
Reduce a number to zero using bit manipulation and math. Simulate the process step-by-step based on whether the number i…
时钟指针的夹角
Calculate the smaller angle between the hour and minute hands of a clock based on given time inputs.
最后 K 个数的乘积
Design a data structure to efficiently return the product of the last k numbers in a dynamic integer stream using prefix…
有效的快递序列数目
Count all valid pickup and delivery sequences for n orders where deliveries occur after pickups using dynamic programmin…
日期之间隔几天
Calculate the exact number of days between two dates using string parsing and arithmetic logic with consistent accuracy.
最接近的因数
Find the closest divisors of num + 1 and num + 2 with minimal absolute difference in this math-driven problem.
形成三的最大倍数
Find the largest number divisible by three by selecting and ordering digits optimally using state transition dynamic pro…
四因数
Compute the sum of all divisors for numbers in an array that have exactly four divisors using array and math techniques.
统计最大组的数目
Count the number of groups with the largest size by summing digits of numbers from 1 to n using a hash table approach.
圆和矩形是否有重叠
Determine if a circle intersects with an axis-aligned rectangle using geometric distance checks efficiently in code.
石子游戏 III
Stone Game III is a challenging dynamic programming problem based on game theory and state transition logic.
和为 K 的最少斐波那契数字数目
Find the minimum number of Fibonacci numbers that sum up to a given integer k, using a greedy approach.
改变一个整数能得到的最大差值
Compute the maximum difference from changing digits in an integer using greedy choices and invariant checks efficiently.
形成两个异或相等数组的三元组数目
Efficiently count all triplets in an array where two subarrays formed by splitting have equal XOR using array scanning a…
最简分数
Generate simplified fractions between 0 and 1 with denominators up to a given integer n.
圆形靶内的最大飞镖数量
Maximize the number of darts on a circular dartboard given dart positions and radius.
两个盒子中球的颜色数相同的概率
Compute the probability that two boxes contain the same number of distinct balls using careful combinatorial and DP meth…
安排邮筒
Allocate k mailboxes to houses along a street minimizing total distance using dynamic programming with state transitions…
数组异或操作
Compute the bitwise XOR of a dynamically generated array using a combination of math and bit manipulation techniques eff…
n 的第 k 个因子
Find the kth factor of n by scanning divisors carefully or using factor pairs to skip unnecessary checks.
石子游戏 IV
Stone Game IV requires predicting the winner using state transition dynamic programming with careful consideration of pe…
好数对的数目
Count all index pairs in an array where elements match and the first index is smaller, using hash-based scanning efficie…
仅含 1 的子串数
Calculate the number of contiguous substrings containing only 1s in a binary string using a math and string approach eff…
服务中心的最佳位置
Find the optimal service center position in a city by minimizing the sum of Euclidean distances to all customers.
换水问题
Maximize the number of water bottles you can drink by simulating the exchange process between full and empty bottles.
在区间范围内统计奇数数目
Count Odd Numbers in an Interval Range efficiently using a math-driven formula that avoids unnecessary iteration over la…
和为奇数的子数组数目
Count the number of subarrays with an odd sum using dynamic programming and prefix sum techniques.
使数组中所有元素相等的最小操作数
Compute the minimum number of operations to equalize a sequential odd-number array using a precise math-driven approach.
你可以获得的最大硬币数目
Solve the Maximum Number of Coins You Can Get using greedy pile selection and invariant validation to maximize your coin…
石子游戏 V
In Stone Game V, Alice divides stones into rows to maximize her score, using a dynamic programming approach to try all d…
将子数组重新排序得到同一个二叉搜索树的方案数
Determine the number of ways to reorder an array to get the same binary search tree (BST) from its insertion order.
分割字符串的方案数
Count the number of ways to split a binary string into three non-empty parts with equal numbers of '1's.
数的平方等于两数乘积的方法数
Find the number of triplets where the square of a number equals the product of two others, utilizing array scanning and …
所有奇数长度子数组的和
Calculate the sum of all odd-length subarrays in a given integer array using efficient array and math strategies.
可见点的最大数目
Determine the maximum number of points visible from a fixed location within a given angle using a sliding window approac…
大小为 K 的不重叠线段的数目
Count all valid arrangements of k non-overlapping line segments on n points using state transition dynamic programming.
奇妙序列
Implement a Fancy sequence supporting append, addAll, and multAll operations efficiently using cumulative math design te…
带阈值的图连通性
In 'Graph Connectivity With Threshold,' determine if cities are connected based on common divisors exceeding a threshold…
统计字典序元音字符串的数目
Calculate the number of length-n strings with vowels only that are sorted lexicographically using state transitions.
第 K 条最小指令
Find the kth smallest lexicographic instruction sequence for reaching a destination in a grid using state transition dyn…
销售价值减少的颜色球
Maximize total value by greedily selling diminishing-valued colored balls based on inventory and customer orders.
连接连续二进制数字
Calculate the decimal value of concatenated binary numbers from 1 to n using efficient bit manipulation techniques.
有序数组中差绝对值之和
Calculate the sum of absolute differences between each element and others in a sorted array efficiently.
石子游戏 VI
Determine the winner in Stone Game VI using a greedy strategy that accounts for each stone's dual value impact on Alice …
比赛中的配对次数
Calculate the total matches in a tournament by simulating rounds and applying simple math rules for advancing teams.
石子游戏 VII
Maximize score difference in a two-player turn-based stone removal game using state transition dynamic programming.
计算力扣银行的钱
Calculate the total amount of money in the Leetcode bank at the end of the nth day, based on a weekly increasing deposit…
猫和老鼠 II
Cat and Mouse II requires determining if the mouse can reach food before being caught using graph and topological orderi…
生成乘积数组的方案数
Determine the number of arrays of size n where the product equals k using prime factorization and combinatorial DP techn…
放置盒子
Optimize the number of boxes touching the floor in a cubic room using binary search to minimize floor occupancy.
盒子中小球的最大数量
The problem asks you to find the box with the maximum number of balls based on the sum of digits of ball numbers.
移除石子的最大得分
Maximize the score in a solitaire game by optimally removing stones from three piles with a greedy approach.
统计同质子字符串的数目
This problem requires counting all homogenous substrings in a given string and returning the result modulo 10^9 + 7.
互质树
Determine the closest coprime ancestor for each node in a tree using efficient traversal and state tracking of node valu…
车队 II
Car Fleet II involves calculating collision times between cars traveling at different speeds along a one-lane road using…
判断一个数字是否可以表示成三的幂的和
Determine if a number can be expressed as the sum of distinct powers of three using a math-driven strategy.
N 次操作后的最大分数和
Maximize the score after n operations by selecting pairs from the array and using their GCD with dynamic programming or …
有界数组中指定下标处的最大值
Maximize the value at a given index of an array with constraints using binary search over the valid answer space.
还原排列的最少操作步数
Find the minimum number of operations to reinitialize a permutation of size n using specific operations.
好因子的最大数目
Solve Maximize Number of Nice Divisors by splitting primeFactors into mostly 3s and using fast modular exponentiation.
判断国际象棋棋盘中一个格子的颜色
Determine whether a given chessboard square is white or black by converting coordinates using a math plus string approac…
统计一个数组中好对子的数目
Count Nice Pairs in an Array requires efficiently pairing numbers where nums[i] + rev(nums[j]) equals nums[j] + rev(nums…
序列中不同最大公约数的数目
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.
找出游戏的获胜者
Find the winner of a circular game by simulating the elimination process with a queue-driven approach.
统计一个圆中点的数目
Determine how many 2D points lie within multiple circles using array iteration and Euclidean distance calculations effic…
使字符串有序的最少操作次数
Calculate the minimum operations to sort a string using combinatorial math and string manipulation techniques efficientl…
所有数对按位与结果的异或和
Compute the XOR sum of all pairwise ANDs between two integer arrays using array and bitwise math techniques efficiently.
K 进制表示下的各位数字总和
Calculate the sum of digits of a number after converting it from base 10 to any given base using a math-driven approach.
最高建筑高度
Find the maximum building height in a city given height restrictions for specific buildings.
增长的内存泄露
Solve Incremental Memory Leak by simulating each second carefully and using math to reason about the crash time bound.
向下取整数对和
The problem asks to calculate the sum of floor divisions for all pairs in a given integer array, using an efficient meth…
找出所有子集的异或总和再求和
Compute the sum of all subset XOR totals using a backtracking search with pruning for arrays of small size.
恰有 K 根木棍可以看到的排列数目
Calculate the number of arrangements of n uniquely-sized sticks so exactly k sticks are visible using dynamic programmin…
石子游戏 VIII
Stone Game VIII requires calculating maximum score difference using state transition dynamic programming on prefix sums …
矩阵中最大的三个菱形和
Find the three largest distinct rhombus sums from a given grid using array and math techniques.
鸡蛋掉落-两枚鸡蛋
Determine the minimum drops needed to find the critical floor using 2 eggs with optimized state transition dynamic progr…
反转表达式值的最少操作次数
Determine the minimum operations to change a boolean expression's result using state transition dynamic programming effi…
字符串中的最大奇数
Find the largest odd number in a string using a greedy approach with careful digit inspection and invariant checks.
你完成的完整对局数
Solve this math plus string problem to calculate the number of full rounds played in a chess tournament between login an…
统计为蚁群构筑房间的不同顺序
Solve the problem of counting distinct ways to build rooms in an ant colony using dynamic programming and topological or…
统计好数字的数目
Count Good Numbers uses a mathematical pattern with recursion to efficiently count digit strings of length n under stric…
统计平方和三元组的数目
Count Square Sum Triples asks to find the number of integer triples where a² + b² = c² for values between 1 and n.
求和游戏
Determine if Alice can force a win in the Sum Game by strategically replacing '?' using a greedy and invariant approach.
三除数
Determine if a given integer has exactly three positive divisors.
收集足够苹果的最小花园周长
Find the minimum perimeter of a square garden that holds enough apples based on a specific formula involving binary sear…
数组元素的最小非零乘积
The problem asks to minimize the product of an array after performing bit-swapping operations on its binary representati…
找出数组的最大公约数
Find the greatest common divisor of the smallest and largest numbers in an integer array.
好子集的数目
Find the number of good subsets in an integer array, where each subset's product is the product of distinct primes.
数组的最大公因数排序
The GCD Sort problem challenges you to sort an array using a specific gcd-based swap method.
可互换矩形的组数
Count all pairs of rectangles that share the exact width-to-height ratio using efficient array scanning and hash lookup.
解出数学表达式的学生分数
Calculate student scores for a single-digit math expression using state transition dynamic programming to track all vali…
找出缺失的观测数据
Given a set of dice rolls, calculate the missing observations based on the mean and return them or determine if it's imp…
石子游戏 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…
获取单值网格的最小操作数
Determine the fewest additions or subtractions of x to make all grid elements identical using array and math logic.
如果相邻两个颜色均相同则删除当前颜色
Alice and Bob play a game removing colored pieces; Alice wins if she makes the last valid move.
下一个更大的数值平衡数
Find the smallest numerically balanced number greater than a given integer using backtracking search and pruning.
所有子字符串中的元音
Compute the total number of vowels in all substrings of a given string using efficient state transition dynamic programm…
k 镜像数字的和
This problem requires finding the sum of the n smallest k-mirror numbers by generating palindromes in base-k and base-10…
引爆最多的炸弹
Determine the maximum number of bombs that can be detonated by leveraging chain reactions using graph traversal and DFS …
股票平滑下跌阶段的数目
Count all contiguous periods where stock prices descend smoothly by exactly one using dynamic programming techniques.
一个区间内所有数乘积的缩写
Calculate the abbreviated product of integers in a range efficiently using math-driven analysis of trailing zeros and si…
反转两次的数字
Determine if reversing a number twice returns the original integer by analyzing trailing zeros and digit placement.
银行中的激光束数量
Calculate total laser beams in a bank floor plan using array counting and math logic between security devices on differe…
得到目标值的最少行动次数
Calculate the fewest steps to reach a target integer using increments and limited doubles with a greedy strategy.
分隔长廊的方案数
Calculate the number of ways to split a corridor into sections with exactly two seats using dynamic programming efficien…
拆分数位后四位数字的最小和
Find the minimum sum of two 2-digit numbers by splitting a four-digit number into two integers.
设置时间的最少代价
Calculate the minimum fatigue to set a microwave cooking time using digit moves and pushes efficiently.
重排数字的最小值
Rearrange the digits of an integer to minimize its value while avoiding leading zeros, keeping the sign unchanged.
得到 0 的操作数
Simulate operations on two integers until one becomes zero, counting how many steps it takes to achieve the result.
找到和为给定整数的三个连续整数
Given a number, find three consecutive integers that sum to it, or return an empty array if no such integers exist.
拆分成最多数目的正偶数之和
Determine the largest set of unique positive even integers that sum to a given finalSum using backtracking and greedy se…
统计各位数字之和为偶数的整数个数
Solve this Easy Math plus Simulation problem by counting numbers whose digit sums are even up to a given limit efficient…
统计可以被 K 整除的下标对数目
Count Array Pairs Divisible by K requires counting index pairs whose products are divisible by a given number k.
向数组中追加 K 个整数
In this problem, you need to append k unique positive integers to a given array nums such that the sum is minimized.
替换数组中的非互质数
Replace Non-Coprime Numbers in Array uses stack-based state management to iteratively merge adjacent non-coprime integer…
找到指定长度的回文数
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.
两整数相加
This problem asks to return the sum of two integers within a specific range, focusing on math-driven solution strategy.
买钢笔和铅笔的方案数
Calculate all distinct ways to spend a fixed total on pens and pencils using a straightforward enumeration strategy.
统计圆内格点数目
Count the number of lattice points inside at least one circle in a grid, based on given center and radius data.
统计打字方案数
Calculate the total number of possible original texts from a pressed key sequence using state transition dynamic program…
找到一个数字的 K 美丽值
Calculate the k-beauty of a number by counting substrings of length k that divide the original number evenly using a sli…
表示一个折线图的最少线段数
Determine the fewest lines needed to accurately connect stock price points in a line chart using array and math reasonin…
个位数字为 K 的整数之和
Determine the minimum set of positive integers whose units digits match k and sum exactly to num using DP patterns.
操作后的最大异或和
Maximize the bitwise XOR of an array after applying a special operation with non-negative integers multiple times.
统计理想数组的数目
This problem involves counting the number of ideal arrays of a given length under certain conditions using state transit…
使数组可以被整除的最少删除次数
Find the minimum number of deletions to make the smallest element in nums divide all elements of numsDivide.
全 0 子数组的数目
Given an array of integers, count the subarrays that consist entirely of 0s.
分组的最大数量
Determine the maximum number of ordered non-empty student groups for a competition using grades array analysis and binar…
统计坏数对的数目
Count the number of bad pairs in an array where the difference between indices and values does not match.
将数组排序的最少替换次数
Minimize the number of operations to make the array sorted in non-decreasing order by replacing elements with sums of tw…
统计特殊整数
Count the number of special integers in the interval [1, n] where digits of each integer are distinct.
严格回文的数字
Determine if a number is strictly palindromic in all bases from 2 to n minus 2 using two-pointer scanning and invariant …
恰好移动 k 步到达某一位置的方法数目
Find the number of ways to reach a position after exactly k steps on an infinite number line using dynamic programming.
统计共同度过的日子数
Count the total number of days Alice and Bob are in Rome together, given their arrival and departure dates.
最小偶倍数
Find the smallest even multiple of a given integer using math and number theory concepts efficiently.
公因子的数目
The problem asks to find the number of common factors of two positive integers a and b.
创建价值相同的连通块
Maximize the number of components in a tree with equal sums by carefully deleting edges using divisor-based logic.
反转之后不同整数的数目
This problem requires counting distinct integers after performing reverse operations on each integer in an array.
反转之后的数字和
Determine if a non-negative integer can be expressed as the sum of a number and its reverse using enumeration and math r…
最大公因数等于 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.
美丽整数的最小增量
Find the minimum addition to a number such that its digits sum to a value less than or equal to a given target.
温度转换
Convert the given Celsius temperature to Kelvin and Fahrenheit using mathematical formulas and return the result in an a…
最小公倍数等于 K 的子数组数目
Find the number of subarrays in an array where the least common multiple (LCM) of the subarray equals a given integer k.
分割圆的最少切割次数
Calculate the fewest cuts required to divide a circle into n equal slices using math and geometric reasoning efficiently…
找出中枢整数
Find the Pivot Integer problem challenges you to identify an integer x that balances prefix sums on both sides.
使用质因数之和替换后可以取到的最小值
Replace a number with the sum of its prime factors until it stabilizes, and return the smallest value.
最小化两个数组中的最大值
Minimize the Maximum of Two Arrays requires finding the smallest possible maximum number across two arrays, using binary…
统计同位异构字符串数目
Learn to count distinct anagrams for a multi-word string using hash tables, math, and combinatorics efficiently.
统计能整除数字的位数
Count the digits that divide a number by checking each digit's divisibility.
数组乘积中的不同质因数数目
Find the number of distinct prime factors in the product of an array of integers.
范围内最接近的两个质数
Find the two closest prime numbers within a given range using efficient number theory techniques and gap comparisons.
根据规则将箱子分类
Classify a box as "Heavy", "Bulky", or "Neither" based on its dimensions and mass using math-driven strategies.
查询数组异或美丽值
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.
使数组中所有元素相等的最小操作数 II
Calculate the minimum operations to make two integer arrays equal using greedy adjustments with modular checks efficient…
判断一个点是否可以到达
Determine if a target point is reachable from (1,1) using math-based moves following number theory rules efficiently.
交替数字和
Compute the alternating digit sum by applying a sign to each digit and summing efficiently using a math-driven approach.
统计桌面上的不同数字
Compute the number of distinct integers generated on a board using repeated modulo operations over a long sequence of da…
猴子碰撞的方法数
Calculate the total number of monkey collisions on a convex polygon using math and recursion efficiently for large n.
替换一个数字后的最大差值
Find the largest difference by remapping a single digit in a number using a greedy approach to maximize and minimize out…
无平方子集计数
Learn how to efficiently count square-free subsets using state transition dynamic programming with bitmask optimizations…
找出字符串的可整除数组
Calculate the divisibility array for a string by checking if prefixes are divisible by a given number.
最小和分割
Split a positive integer into two parts to minimize their sum using a greedy approach and sorting.
统计染色格子数
The "Count Total Number of Colored Cells" problem requires deriving a formula to compute colored cells based on elapsed …
递枕头
Pass the Pillow simulates the process of passing an item through a line of people, adjusting the direction based on time…
分割数组使乘积互质
Find the smallest index to split an array so that the products of two parts are coprime using array scanning and hash lo…
将钱分给最多的儿童
Determine the maximum number of children who can each receive exactly 8 dollars using a greedy approach with validation …
美丽子集的数目
Count all non-empty subsets of an array where no two numbers have an absolute difference equal to k, using array scannin…
执行操作后的最大 MEX
Find the smallest missing non-negative integer after repeated additions or subtractions of a given value in nums array e…
K 件物品的最大和
Select k items from a bag containing 1, 0, and -1 to maximize sum using greedy choice and invariant validation strategie…
质数减法运算
Determine if it's possible to make the array strictly increasing using prime subtractions.
使子数组元素和相等
Solve Make K-Subarray Sums Equal by grouping circular indices with gcd cycles and minimizing each group to its median.
对角线上的质数
Find the largest prime number located on any diagonal of a square matrix using array iteration and prime checking techni…
计算列车到站时间
Calculate the new arrival time of a delayed train in 24-hour format by using basic math operations.
倍数求和
Find the sum of integers divisible by 3, 5, or 7 in the range [1, n].
使数组所有元素变成 1 的最少操作次数
Find the minimum number of operations to transform every element of a positive integer array into 1 using gcd operations…
英雄的力量
Calculate the total power of all non-empty hero groups using state transition dynamic programming efficiently with sorti…
求一个整数的惩罚数
Find the punishment number of a given integer using backtracking search with pruning.
最大公约数遍历
Determine if every index in an array can be reached from any other using traversals based on greatest common divisors.
统计整数数目
Count of Integers challenges you to find the number of integers with a digit sum between a given range using dynamic pro…
判断一个数是否迷人
Determine if a 3-digit number is fascinating by checking if the concatenated result of n, 2*n, and 3*n contains all digi…
总行驶距离
Calculate the maximum distance a truck can travel using main and additional fuel tanks with controlled transfers.
构造最长的新字符串
Maximize the length of a string built from AA, BB, and AB without creating triple repeats using DP and greedy logic.
美丽下标对的数目
Count all index pairs in an array where the first digit of one number and last digit of another are coprime efficiently.
将数组划分成若干好子数组的方式
Calculate the number of ways to partition a binary array into good subarrays using state transition dynamic programming …
和等于目标值的质数对
Find all prime number pairs that sum up to a given integer n using an efficient sieve-based array approach.
找出最大的可达成数字
Determine the largest number achievable by repeatedly applying a simple math operation up to t times efficiently.
长度递增组的最大数目
Maximize the number of groups that can be formed with given usage limits, leveraging binary search for optimal solutions…
取整购买后的账户余额
Given a purchase amount, calculate the account balance after rounding the purchase to the nearest multiple of 10 and ded…
在链表中插入最大公约数
The problem involves inserting greatest common divisors between adjacent nodes in a linked list.
翻倍以链表形式表示的数字
Double a number represented as a linked list by carefully managing node values and carries with pointer traversal techni…
操作使得分最大
Maximize the score by applying operations on a subarray at most k times, utilizing stack-based state management.
范围中美丽整数的数目
Count all integers in a given range that have equal even and odd digits and are divisible by k using DP.
k-avoiding 数组的最小总和
Determine the minimum sum of a k-avoiding array by choosing distinct integers such that no pair sums to a given k.
找出美丽数组的最小和
Find the minimum possible sum of a beautiful array that satisfies the given conditions with the greedy approach.
统计一个字符串的 k 子序列美丽值最大的数目
Determine the number of k-length unique subsequences in a string that maximize the sum of character frequencies efficien…
统计对称整数的数目
Count Symmetric Integers finds numbers where the sum of the first half of digits equals the sum of the second half withi…
生成特殊数字的最少操作
Minimize operations to make a number divisible by 25 by deleting digits. Use greedy choice and invariant validation.
判断能否在给定时间到达单元格
The problem asks if a target cell can be reached from a starting position within a given time on a 2D grid.
字符串转换
Find how many ways string s can be transformed into string t in exactly k operations using suffix rotations.
完全子集的最大元素和
Given a 1-indexed array, select a subset where indices' product is a perfect square, then return the maximum sum.
最大二进制奇数
Rearrange a binary string to form the largest odd binary number using a greedy approach and least significant bit valida…
统计树中的合法路径数目
Count Valid Paths in a Tree involves finding paths with exactly one prime number in a tree of n nodes.
分类求和并作差
Compute the difference between sums of integers divisible and non-divisible by m using a direct arithmetic approach effi…
给小朋友们分糖果 I
Given two integers n and limit, find the number of ways to distribute n candies among 3 children, with no child receivin…
给小朋友们分糖果 II
Determine how to distribute n candies among 3 children without exceeding a limit on individual candies.
重新排列后包含指定子字符串的字符串数目
Calculate how many strings of length n can be rearranged to contain "leet" using dynamic programming and combinatorics.
最大异或乘积
Find the maximum value of (a XOR x) * (b XOR x) using greedy bitwise choices and invariant validation.
循环移位后的矩阵相似检查
Determine if a matrix returns to its original state after performing cyclic row shifts k times using array and math patt…
统计美丽子字符串 I
Given a string and a value k, count the number of beautiful substrings where vowels * consonants % k == 0.
统计美丽子字符串 II
Count Beautiful Substrings II focuses on finding beautiful substrings with hash tables and number theory techniques.
统计感冒序列的数目
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…
统计好分割方案的数目
Calculate how many ways to partition an array into contiguous subarrays where no number repeats across segments using ha…
找出缺失和重复的数字
Find the missing and repeated numbers in an n x n grid using array scanning and hash lookup.
使数组成为等数数组的最小代价
Determine the minimum cost to convert an integer array into a palindromic array using allowed element modifications effi…
统计强大整数的数目
Count the number of powerful integers in a given range by applying state transition dynamic programming with constraints…
捕获黑皇后需要的最少移动次数
Determine the fewest moves to capture the black queen using only white pieces with careful position analysis.
通过操作使数组长度最小
Minimize the length of an integer array through a series of operations, using a greedy approach with modular arithmetic.
输入单词需要的最少按键次数 I
Calculate the minimum pushes to type a word using a remapped telephone keypad with greedy allocation of letters.
Alice 和 Bob 玩鲜花游戏
Alice and Bob play a turn-based game on a circular field with flowers, where players must choose pairs that satisfy pari…
三角形类型
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 most frequent prime over 10 from numbers generated by scanning a 2D matrix in all straight directions efficient…
求交集区域内的最大正方形面积
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…
统计以给定字符开头和结尾的子字符串总数
Given a string and a character, find the total number of substrings that start and end with that character.
执行操作使数据元素之和大于等于 K
Given an array nums, find the minimum number of operations to make the sum of elements greater than or equal to k.
哈沙德数
Given an integer, determine if it is a Harshad number by checking if it's divisible by the sum of its digits.
换水问题 II
Compute the maximum number of water bottles you can drink by simulating exchanges with step-by-step math logic.
交替子数组计数
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 小金额
Find the kth smallest amount using only one coin denomination at a time, applying binary search efficiently over possibl…
直角三角形
Count all possible right triangles in a 2D boolean grid using array scanning and hash lookup for efficiency.
所有数对中数位差之和
Sum of Digit Differences of All Pairs is a problem that involves counting digit differences in pairs from an array of in…
到达第 K 级台阶的方案数
Determine the total number of ways to reach the k-th stair using a state transition dynamic programming approach with co…
找出 K 秒后拿着球的孩子
Find the child who holds the ball after k seconds of passing in a queue, considering reversals at both ends.
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.
求出硬币游戏的赢家
In this game between Alice and Bob, players must pick coins summing to 115. Alice starts, and the goal is to determine t…
字符串元音游戏
Solve the Vowels Game in a String using optimal moves and string analysis to predict the winner efficiently and accurate…
判断是否可以赢得数字游戏
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.
单调数组对的数目 I
Compute the number of monotonic pairs in an integer array using state transition dynamic programming efficiently.
单调数组对的数目 II
This problem involves finding the count of monotonic pairs in an array using dynamic programming and combinatorics techn…
找出最大的 N 位 K 回文数
Compute the largest n-digit integer divisible by k that forms a palindrome using state transition dynamic programming te…
K 次乘运算后的最终数组 I
Solve the problem of determining the final state of an array after multiple multiplication operations using a priority q…
求出数字答案
Determine the four-digit key from three given numbers using a precise math-driven approach for exact digit alignment.
统计好整数的数目
Count good integers by rearranging digits to form k-palindromic numbers, leveraging hash tables and math techniques.
检查棋盘方格颜色是否相同
Determine if two chessboard squares share the same color using coordinate math and simple string manipulation for quick …
将日期转换为二进制表示
Convert a given Gregorian date string to its binary format by transforming year, month, and day individually without lea…
吃掉所有兵需要的最多移动次数
Calculate the maximum number of moves to eliminate all pawns using BFS, bitmasking, and precise array position math effi…
数字小镇中的捣蛋鬼
Find the two numbers that appear twice in a list of integers from 0 to n-1 using array scanning plus hash lookup efficie…
移山所需的最少秒数
Determine the minimum seconds required to reduce a mountain to zero height using simultaneous workers efficiently.
替换为数位和以后的最小元素
Replace each number with its digit sum and return the smallest resulting value, using array plus math techniques efficie…
找出第 K 个字符 I
Find the K-th character in a progressively built string using math and bit manipulation efficiently.
找出第 K 个字符 II
Find the K-th character in a string game using bit manipulation and recursion, optimizing performance for large k values…
查询排序后的最大公约数
Solve the Sorted GCD Pair Queries problem by efficiently counting and locating GCDs of all array pairs using hash mappin…
安排活动的方案数
Given n performers, x stages, and y scores, calculate the number of possible ways to assign performers and score bands.
使数组非递减的最少除法操作次数
Determine the minimum number of division operations to make an array non-decreasing using a greedy and invariant-based s…
数组的最大因子得分
Calculate the maximum factor score of an integer array by optionally removing one element using LCM and GCD computations…
字符串转换后的长度 I
Calculate the total number of characters in a string after repeated transformations using dynamic programming and freque…
最大公约数相等的子序列数量
Count all pairs of non-empty subsequences in an integer array whose elements share the same greatest common divisor effi…
字符串转换后的长度 II
Calculate the length of a string after repeated transformations using state transition dynamic programming for large t v…
统计平衡排列的数目
Determine how many distinct permutations of a digit string are balanced using state transition dynamic programming effic…
最小可整除数位乘积 I
Find the smallest number greater than or equal to n whose digit product is divisible by t.
最小可整除数位乘积 II
Find the smallest zero-free number at least as large as num whose digits multiply to a product divisible by t using care…
统计小于 N 的 K 可约简整数
This problem challenges you to count the K-reducible numbers less than a given binary integer using dynamic programming.
移除石头游戏
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…
仅含置位位的最小整数
Find the smallest number greater than or equal to n with all set bits in its binary representation.
使两个整数相等的数位操作
Transform n into m using allowed digit operations without creating primes, applying math and graph strategies efficientl…
统计最小公倍数图中的连通块数目
Determine the number of connected components in an LCM-based graph using array scanning and hash-based connectivity chec…
用点构造面积最大的矩形 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…
唯一中间众数子序列 I
Count subsequences of size 5 with a unique middle mode in an integer array using hash table and combinatorics.
统计特殊子序列的数目
Count the number of special subsequences in an array of positive integers, focusing on efficient array scanning and hash…
统计恰好有 K 个相等相邻元素的数组数目
Count the number of valid arrays with exactly k adjacent elements that are equal, using math and combinatorics technique…
最长乘积等价子数组
This problem involves finding the longest subarray where the product equals the LCM multiplied by the GCD, leveraging a …
所有安放棋子方案的曼哈顿距离
This problem challenges you to calculate Manhattan distances in all valid arrangements of identical pieces on a grid.
最多 K 个元素的子序列的最值之和
Find the sum of the maximum and minimum elements of subsequences with at most k elements, using dynamic programming.
最多 K 个元素的子数组的最值之和
Compute the sum of maximum and minimum values in all subarrays up to size k using efficient stack-based state management…
统计元素和差值为偶数的分区方案
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…
K 次修改后的最大曼哈顿距离
Solve Maximum Manhattan Distance After K Changes by scanning prefixes and testing the four diagonal target pairs with li…
使数组包含目标值倍数的最少增量
This problem involves incrementing elements of an array to make sure each target element has at least one multiple in th…
判断操作后字符串中的数字是否相等 I
Simulate repeated adjacent digit sums modulo 10 until two digits remain, then check whether those final digits match.
判断操作后字符串中的数字是否相等 II
Determine if repeated digit-sum operations on a numeric string reduce it to two equal digits using math and string techn…
可行数组的数目
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…
船上可以装载的最大集装箱数量
Determine the maximum number of containers that can be loaded onto a ship's deck without exceeding weight limits.
使数组元素都变为零的最少操作次数
Minimize operations to reduce array elements to zero, focusing on array manipulation, math, and bit operations for effic…
使 K 个子数组内元素相等的最少操作数
Compute the minimum operations to ensure at least k non-overlapping subarrays of size x have all equal elements efficien…
使数组和能被 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…
找到最近的人
Determine which of two people reaches a third person first using a simple math-driven distance comparison strategy.
最小回文排列 II
Find the k-th lexicographically smallest palindromic rearrangement of a given palindromic string s.
统计逐位非递减的整数
Count all integers between l and r whose digits never decrease in base b using state transition dynamic programming effi…
求出数组的 X 值 I
Determine the x-value of an array using state transition dynamic programming to count valid prefix-suffix operations 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 highest product obtainable from any two digits of a given positive integer using math and sorting techniques ef…
魔法序列的数组乘积之和
Use state transition dynamic programming to count magical index sequences and accumulate weighted products without enume…
数位和等于下标的最小下标
Find the smallest index in an array where the sum of the digits equals the index.
最大质数子字符串之和
Compute the sum of the three largest unique primes from all substrings using hash table plus math efficiently.
给边赋权值的方案数 I
Calculate the number of valid edge weight assignments in a tree using DFS and binary-tree traversal with careful state t…
给边赋权值的方案数 II
This problem involves assigning edge weights in a tree and calculating the cost of paths based on these weights.
木材运输的最小成本
Calculate the minimum cost to transport two logs using a math-driven strategy considering cutting costs and truck limits…
分割数组后不同质数的最大数目
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…
找到最大三角形面积
Find the maximum area of a triangle from 2D coordinates with at least one side parallel to the x-axis or y-axis.
计数质数间隔平衡子数组
Count the number of prime-gap balanced subarrays in an integer array using sliding window techniques and running state u…
检查元素频次是否为质数
Check if any element in the array has a prime frequency count, leveraging array scanning and hash table lookup.
十六进制和三十六进制转化
Solve Hexadecimal and Hexatrigesimal Conversion by converting n squared to base 16 and n cubed to base 36, then joining …
数组的最小稳定性因子
The problem requires finding the minimum stability factor of an array by utilizing binary search and math-based optimiza…
到达目标点的最小移动次数
Find the minimum number of moves to reach a target point from a start point on a 2D grid with a math-driven solution.
根据质数下标分割数组
Split Array by Prime Indices challenges you to separate elements at prime positions and minimize the absolute sum differ…
位计数深度为 K 的整数数目 I
Calculate the number of integers in a given range with a specific popcount-depth using state transition dynamic programm…
判断整除性
Determine if a positive integer is divisible by the sum of its digits plus their product using a math-driven strategy.
统计梯形的数目 I
Given a list of distinct points, count the number of unique horizontal trapezoids that can be formed by selecting four p…
统计梯形的数目 II
Count Number of Trapezoids II requires scanning point pairs and hashing slopes to efficiently find parallel sides in arr…
划分数组得到最大异或运算和与运算之和
Partition the array into three subsequences to maximize XOR and AND operations with a greedy approach.