Back to all patterns

Tree DFS / Recursion

1 problems • Practice on LeetCode to earn credits

About This Pattern

Master the Tree DFS / Recursion pattern by practicing these problems organized by difficulty.Focus on the Key Signals - these are the indicators that tell you when to use this pattern.

Easy (1)

Invert Binary Tree

Invert a binary tree (swap left and right children recursively).

Key Signals:

Recursive swapBase case: nullPost-order or pre-order