LeetCodechevron_rightCategorieschevron_rightunion find
merge_type

union find

74 problems
Easy: 1Medium: 40Hard: 33

union find is one of the most repeated interview dimensions. Start with edge-safe fundamentals, then move into pattern-level trade-offs.

Interview Signal

Frequently tests problem modeling, edge handling, and verbal clarity.

Common Pitfall

Template-only answers break under follow-up questioning.

Practice Strategy

Practice in 3-5 problem rounds and always review complexity alternatives.

Recommended Progression

Problem bank

union find problem bank

Start with a compact scan-friendly list and progressively load more so the topic page stays readable even when the corpus is large.

Progressive topic library

Built for large topic sets: scan the structure first, then go deeper.

hourglass_bottomScroll to continue
search
tuneDifficulty

Showing 24 / 74 problems

+24 per load
#TitleDifficulty
128

Longest Consecutive Sequence

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

Medium
130

Surrounded Regions

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

Medium
200

Number of Islands

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

Medium
399

Evaluate Division

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

Medium
547

Number of Provinces

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

Medium
684

Redundant Connection

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

Medium
685

Redundant Connection II

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

Hard
695

Max Area of Island

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

Medium
721

Accounts Merge

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

Medium
765

Couples Holding Hands

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

Hard
778

Swim in Rising Water

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

Hard
785

Is Graph Bipartite?

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

Medium
803

Bricks Falling When Hit

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

Hard
827

Making A Large Island

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

Hard
839

Similar String Groups

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

Hard
886

Possible Bipartition

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

Medium
924

Minimize Malware Spread

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

Hard
928

Minimize Malware Spread II

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

Hard
947

Most Stones Removed with Same Row or Column

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

Medium
952

Largest Component Size by Common Factor

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

Hard
959

Regions Cut By Slashes

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

Medium
990

Satisfiability of Equality Equations

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

Medium
1020

Number of Enclaves

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

Medium
1061

Lexicographically Smallest Equivalent String

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

Medium

swap_vertScroll inside the bank to auto-load more

Related Patterns

Union Find LeetCode Problems: 74 Solutions