Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Union Find知识点可以增加更多例题 #2771

Open
zhihali opened this issue Oct 1, 2024 · 0 comments
Open

Union Find知识点可以增加更多例题 #2771

zhihali opened this issue Oct 1, 2024 · 0 comments

Comments

@zhihali
Copy link
Contributor

zhihali commented Oct 1, 2024

在Amazon和Meta的面试中Union Find并查集时候考到的,除了卡马网的三道题建议增加一些leetcode上的板子题作为训练。

以下是我做了很多之后整理出来比较好的题

261 - Graph Valid Tree

This problem asks you to determine if a given undirected graph is a valid tree.
A valid tree is an undirected graph in which any two vertices are connected by exactly one path.
It's typically solved using Union-Find (Disjoint Set) or Depth-First Search (DFS) algorithms.

323 - Number of Connected Components in an Undirected Graph

This problem asks you to count the number of connected components in an undirected graph.
It can be solved using either Depth-First Search (DFS), Breadth-First Search (BFS), or Union-Find algorithms.

721 - Accounts Merge

This problem involves merging email accounts based on common email addresses.
It's typically solved using a Union-Find (Disjoint Set) data structure or Depth-First Search (DFS).

547 - Number of Provinces

This problem asks you to find the number of provinces (connected components) in a graph represented by an adjacency matrix.
It can be solved using Depth-First Search (DFS), Breadth-First Search (BFS), or Union-Find algorithms.

305 - Number of Islands II

This is a dynamic version of the Number of Islands problem.
It involves adding land to a 2D grid and counting the number of islands after each addition.
It's typically solved using a Union-Find (Disjoint Set) data structure.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant