Skip to main content

Trees / DFS

Recursive and iterative depth-first traversal for tree structure problems.

16 problems 4 Easy 10 Medium 2 Hard

Problems (16)

Problem Link
Invert Binary Tree
Maximum Depth of Binary Tree
Validate Binary Search Tree
Lowest Common Ancestor of a BST
Binary Tree Maximum Path Sum
Serialize and Deserialize Binary Tree
Diameter of Binary Tree
Symmetric Tree
Binary Tree Right Side View
Kth Smallest Element in a BST
Construct Binary Tree from Preorder and Inorder Traversal
Path Sum II
Count Good Nodes in Binary Tree
Flatten Binary Tree to Linked List
Sum Root to Leaf Numbers
Populating Next Right Pointers in Each Node

Related Guide

Binary Tree LeetCode Problems — Every Pattern You Need [2026] →

Trees appear in nearly every FAANG interview. Here's every tree pattern — DFS, BFS, LCA, BST, path p…

Enjoying this free content?

If this saved you time, buying me a coffee keeps new content coming.

Buy me a coffee
Buy me a coffee