Graph
LeetCode 851: Loud and Rich
·2 mins
LeetCode
Medium
Graph
Topological-Sort
LeetCode note for Loud and Rich, rebuilt from the original learning note
LeetCode 802: Find Eventual Safe States
·3 mins
LeetCode
Medium
Graph
Topological-Sort
LeetCode note for Find Eventual Safe States, rebuilt from the original learning note
LeetCode 1203: Sort Items by Groups Respecting Dependencies
·3 mins
LeetCode
Hard
Graph
Topological-Sort
LeetCode note for Sort Items by Groups Respecting Dependencies, rebuilt from the original learning note
LeetCode 3898: Find the Degree of Each Vertex
·1 min
LeetCode
Easy
Graph
Matrix
Array
LeetCode 3898 note: the number of ones in row i of the adjacency matrix is vertex i’s degree
LeetCode 310: Minimum Height Trees
·3 mins
LeetCode
Medium
Graph
Topological-Sort
LeetCode note for Minimum Height Trees, rebuilt from the original learning note
LeetCode 2115: Find All Possible Recipes from Given Supplies
·3 mins
LeetCode
Medium
Graph
Topological-Sort
LeetCode note for Find All Possible Recipes from Given Supplies, rebuilt from the original learning note
LeetCode 2192: All Ancestors of a Node in a DAG
·3 mins
LeetCode
Medium
Graph
Topological-Sort
LeetCode note for All Ancestors of a Node in a DAG, rebuilt from the original learning note
LeetCode 210: Course Schedule II
·2 mins
LeetCode
Medium
Graph
Topological-Sort
LeetCode note for Course Schedule II, rebuilt from the original learning note
LeetCode 207: Course Schedule
·2 mins
LeetCode
Medium
Graph
Topological-Sort
LeetCode note for Course Schedule, rebuilt from the original learning note
LeetCode 1971: Find if Path Exists in Graph
·2 mins
LeetCode
Easy
Graph
Union-Find
LeetCode note for Find if Path Exists in Graph, rebuilt from the original learning note
LeetCode 3820: Pythagorean Distance Nodes in a Tree
·2 mins
LeetCode
Medium
Tree
Bfs
Graph
LeetCode 3820 note: three BFS runs give every node’s distance to the three targets
LeetCode 1782: Count Pairs Of Nodes
·3 mins
LeetCode
Hard
Two-Pointers
Graph
Sorting
Hash-Table
Counting
LeetCode 1782 note: count pairs with deg[a] + deg[b] > q using sorted degrees and converging pointers, then correct the over-count for pairs that share edges