dsa6 min read
Trees — Complete Guide: All Patterns & Problem Index
Master every tree pattern: DFS traversals, BFS level-order, BST operations, LCA, path sum, and serialization — with templates and full index of 75 problems.
Read →
1575 articles
Master every tree pattern: DFS traversals, BFS level-order, BST operations, LCA, path sum, and serialization — with templates and full index of 75 problems.
Find the maximum depth of a binary tree using recursive DFS (one line) or iterative BFS level counting.
Invert a binary tree by recursively swapping left and right children at every node.
Check if a binary tree is symmetric by comparing mirror subtrees with a two-pointer recursive approach.
Determine if a root-to-leaf path exists with a given sum using DFS that subtracts each node value from the target.