题库chevron_right分类chevron_right数论
label

数论

73 道题目
简单: 11中等: 30困难: 32

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

面试场景

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

常见误区

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

练习策略

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

推荐练习顺序

题库

数论 题库

先展示一段最适合快速浏览的题目列表,继续滚动时再慢慢续载,避免专题页被长列表一下子拉穿。

慢加载专题题库

适合这类题很多的专题,先扫结构,再逐步深入。

hourglass_bottom滚动续载
search
tune难度

当前展示 24 / 73 道题目

每次续载 24 题
#题目难度
204

计数质数

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

中等
258

各位相加

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

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

中等
914

卡牌分组

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

简单
952

按公因数计算最大组件大小

Find the largest connected component in an array where edges exist between numbers sharing a common factor greater than …

困难
1201

丑数 III

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

中等
1250

检查「好数组」

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

困难
1447

最简分数

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

中等
1492

n 的第 k 个因子

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

中等
1627

带阈值的图连通性

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

困难
1735

生成乘积数组的方案数

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

困难
1766

互质树

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

困难
1799

N 次操作后的最大分数和

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

困难
1808

好因子的最大数目

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

困难
1819

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

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

困难
1952

三除数

Determine if a given integer has exactly three positive divisors.

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

中等
2183

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

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

困难
2197

替换数组中的非互质数

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

困难
2280

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

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

中等

swap_vert在题库框内继续向下滚动,也会自动续载

关联高频模式

LeetCode 数论题型题解:73题训练路线