题库chevron_right分类chevron_right并查集
merge_type

并查集

74 道题目
简单: 1中等: 40困难: 33

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

面试场景

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

常见误区

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

练习策略

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

推荐练习顺序

题库

并查集 题库

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

慢加载专题题库

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

hourglass_bottom滚动续载
search
tune难度

当前展示 24 / 74 道题目

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

最长连续序列

Find the length of the longest consecutive elements sequence in an unsorted array using array scanning and hash lookup.

中等
130

被围绕的区域

Transform the matrix in-place by marking regions surrounded by 'X' as 'X', while keeping border-adjacent 'O's intact.

中等
200

岛屿数量

Count the number of distinct islands in a binary grid using array traversal combined with depth-first search exploration…

中等
399

除法求值

Compute the results of division queries from given equations using graph traversal and depth-first search efficiently.

中等
547

省份数量

Solve Number of Provinces by scanning the adjacency matrix and launching DFS once per unvisited city component.

中等
684

冗余连接

Identify and remove the redundant edge that causes a cycle in a graph starting as a tree.

中等
685

冗余连接 II

Find and remove the redundant connection in a directed graph that was originally a rooted tree.

困难
695

岛屿的最大面积

Find the largest connected land area in a binary grid using array traversal and depth-first search efficiently.

中等
721

账户合并

Merge accounts by connecting emails and returning each user's sorted email list using array scanning and hash lookup eff…

中等
765

情侣牵手

This problem requires arranging couples sitting apart in a row with the minimum number of swaps using graph traversal an…

困难
778

水位上升的泳池中游泳

Solve the problem of swimming through a grid of rising water with a binary search on the valid answer space.

困难
785

判断二分图

Determine whether an undirected graph can be split into two independent sets using DFS, BFS, or Union Find patterns.

中等
803

打砖块

Bricks Falling When Hit challenges your ability to simulate brick falls after sequential erasures using Union Find.

困难
827

最大人工岛

Calculate the largest island size by converting at most one zero in a binary grid using array and DFS techniques efficie…

困难
839

相似字符串组

Determine the number of connected groups of similar strings by swapping at most two letters using array scanning and has…

困难
886

可能的二分法

Determine if a group of n people with mutual dislikes can be split into two non-conflicting groups using graph traversal…

中等
924

尽量减少恶意软件的传播

Identify which single infected node to remove to minimize total malware spread in a connected network graph efficiently.

困难
928

尽量减少恶意软件的传播 II

Minimize Malware Spread II asks to minimize the spread of malware in a network of nodes by removing one infected node.

困难
947

移除最多的同行或同列石头

Maximize the number of stones removed from a 2D plane using graph traversal and DFS.

中等
952

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

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

困难
959

由斜杠划分区域

Determine the number of regions in a grid divided by slashes using array scanning and union-find techniques efficiently.

中等
990

等式方程的可满足性

Determine if it's possible to assign values to variables such that all equations are satisfied based on equality and ine…

中等
1020

飞地的数量

This problem involves finding the number of land cells that cannot reach the boundary in a grid using DFS and array mani…

中等
1061

按字典序排列最小的等效字符串

Determine the lexicographically smallest string by modeling character equivalences with union find efficiently.

中等

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

关联高频模式

LeetCode 并查集题型题解:74题训练路线