题库chevron_right分类chevron_right组合数学
label

组合数学

49 道题目
简单: 3中等: 14困难: 32

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

面试场景

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

常见误区

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

练习策略

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

推荐练习顺序

#题目难度
62

不同路径

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

中等
458

可怜的小猪

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

困难
920

播放列表的数量

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

困难
1201

丑数 III

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

中等
1359

有效的快递序列数目

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

困难
1467

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

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

困难
1569

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

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

困难
1621

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

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

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

困难
1735

生成乘积数组的方案数

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

困难
1830

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

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

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

困难
1916

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

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

困难
2063

所有子字符串中的元音

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

中等
2221

数组的三角和

The problem asks for calculating the triangular sum of an array through repeated pairwise summation.

中等
2338

统计理想数组的数目

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

困难
2400

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

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

中等
2514

统计同位异构字符串数目

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

困难
2597

美丽子集的数目

Count all non-empty subsets of an array where no two numbers have an absolute difference equal to k, using array scannin…

中等
2842

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

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

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

中等
2954

统计感冒序列的数目

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

困难
2963

统计好分割方案的数目

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

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

中等
3154

到达第 K 级台阶的方案数

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

困难
3179

K 秒后第 N 个元素的值

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

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

困难
3272

统计好整数的数目

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

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

困难
3343

统计平衡排列的数目

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

困难
3352

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

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

困难
3395

唯一中间众数子序列 I

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

困难
3405

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

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

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

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

困难
3470

全排列 IV

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

困难
3518

最小回文排列 II

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

困难
3539

魔法序列的数组乘积之和

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

困难
3577

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

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

中等
3621

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

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

困难

关联高频模式

LeetCode 组合数学题型题解:49题训练路线