面试场景
高频考察问题建模、边界条件与口头表达的清晰度。
常见误区
只背模板不解释为什么,容易在追问里失分。
练习策略
每轮练 3-5 题,固定复盘复杂度和可替代解法。
推荐练习顺序
不同路径
Calculate the number of unique paths for a robot to move on an m x n grid with only right and down movements.
可怜的小猪
Find the minimum number of pigs required to determine the poisonous bucket within a set time using state transition dyna…
播放列表的数量
Solve the Number of Music Playlists problem with dynamic programming, focusing on state transitions and combinatorics to…
丑数 III
Find the nth positive integer divisible by a, b, or c using binary search over the answer space efficiently and accurate…
有效的快递序列数目
Count all valid pickup and delivery sequences for n orders where deliveries occur after pickups using dynamic programmin…
两个盒子中球的颜色数相同的概率
Compute the probability that two boxes contain the same number of distinct balls using careful combinatorial and DP meth…
将子数组重新排序得到同一个二叉搜索树的方案数
Determine the number of ways to reorder an array to get the same binary search tree (BST) from its insertion order.
大小为 K 的不重叠线段的数目
Count all valid arrangements of k non-overlapping line segments on n points using state transition dynamic programming.
统计字典序元音字符串的数目
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…
生成乘积数组的方案数
Determine the number of arrays of size n where the product equals k using prime factorization and combinatorial DP techn…
使字符串有序的最少操作次数
Calculate the minimum operations to sort a string using combinatorial math and string manipulation techniques efficientl…
找出所有子集的异或总和再求和
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…
统计为蚁群构筑房间的不同顺序
Solve the problem of counting distinct ways to build rooms in an ant colony using dynamic programming and topological or…
所有子字符串中的元音
Compute the total number of vowels in all substrings of a given string using efficient state transition dynamic programm…
数组的三角和
The problem asks for calculating the triangular sum of an array through repeated pairwise summation.
统计理想数组的数目
This problem involves counting the number of ideal arrays of a given length under certain conditions using state transit…
恰好移动 k 步到达某一位置的方法数目
Find the number of ways to reach a position after exactly k steps on an infinite number line using dynamic programming.
统计同位异构字符串数目
Learn to count distinct anagrams for a multi-word string using hash tables, math, and combinatorics efficiently.
美丽子集的数目
Count all non-empty subsets of an array where no two numbers have an absolute difference equal to k, using array scannin…
统计一个字符串的 k 子序列美丽值最大的数目
Determine the number of k-length unique subsequences in a string that maximize the sum of character frequencies efficien…
给小朋友们分糖果 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.
统计感冒序列的数目
Calculate all valid infection sequences in a line by using array positions and combinatorial math efficiently for n peop…
统计好分割方案的数目
Calculate how many ways to partition an array into contiguous subarrays where no number repeats across segments using ha…
单面值组合的第 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.
到达第 K 级台阶的方案数
Determine the total number of ways to reach the k-th stair using a state transition dynamic programming approach with co…
K 秒后第 N 个元素的值
Solve for the N-th value after K seconds by simulating array updates and using prefix sum techniques.
单调数组对的数目 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…
统计好整数的数目
Count good integers by rearranging digits to form k-palindromic numbers, leveraging hash tables and math techniques.
查询排序后的最大公约数
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 how many distinct permutations of a digit string are balanced using state transition dynamic programming effic…
统计小于 N 的 K 可约简整数
This problem challenges you to count the K-reducible numbers less than a given binary integer using dynamic programming.
唯一中间众数子序列 I
Count subsequences of size 5 with a unique middle mode in an integer array using hash table and combinatorics.
统计恰好有 K 个相等相邻元素的数组数目
Count the number of valid arrays with exactly k adjacent elements that are equal, using math and combinatorics technique…
所有安放棋子方案的曼哈顿距离
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.
判断操作后字符串中的数字是否相等 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…
全排列 IV
Find the k-th alternating permutation of numbers 1 to n, ensuring no adjacent numbers share parity, using array and math…
最小回文排列 II
Find the k-th lexicographically smallest palindromic rearrangement of a given palindromic string s.
魔法序列的数组乘积之和
Use state transition dynamic programming to count magical index sequences and accumulate weighted products without enume…
统计计算机解锁顺序排列数
Calculate the total valid unlocking sequences for computers based on their complexity using array and combinatorics logi…
位计数深度为 K 的整数数目 I
Calculate the number of integers in a given range with a specific popcount-depth using state transition dynamic programm…