Coding Interview
323. Number of Connected Components in an Undirected Graph
Jason Yang · 04 Aug, 2026
Number of Connected Components (LeetCode 323) in Java: count merges instead of nodes with Union-Find, or flood-fill each unvisited node with DFS.
Coding Interview
Jason Yang · 04 Aug, 2026
Number of Connected Components (LeetCode 323) in Java: count merges instead of nodes with Union-Find, or flood-fill each unvisited node with DFS.
Coding Interview
Jason Yang · 04 Aug, 2026
Coin Change (LeetCode 322): why grabbing the biggest coin fails, and the bottom-up DP that finds the fewest coins for an amount in O(amount × coins) — in Java.
Coding Interview
Jason Yang · 04 Aug, 2026
Longest Increasing Subsequence (LeetCode 300): the O(n^2) DP for the intuition, then the O(n log n) patience-sorting trick with binary search, in Java.
Coding Interview
Jason Yang · 04 Aug, 2026
Serialize and Deserialize Binary Tree (LeetCode 297): why a preorder walk with explicit null markers round-trips any tree, coded cleanly in Java.
Coding Interview
Jason Yang · 04 Aug, 2026
Find Median from Data Stream (LeetCode 295): balance a max-heap and a min-heap so the median sits at the top, with O(log n) inserts in Java.