Binary Tree Problems
130 Binary Tree LeetCode problems · Solve with AI-powered hints & step-by-step explanations.
Learn the coding interview patterns behind these problems, including Binary Tree interview patterns.
Start with these
98 Validate Binary Search Tree Medium100 Same Tree Easy102 Binary Tree Level Order Traversal Medium104 Maximum Depth of Binary Tree Easy105 Construct Binary Tree from Preorder and Inorder Traversal Medium124 Binary Tree Maximum Path Sum Hard226 Invert Binary Tree Easy230 Kth Smallest Element in a BST Medium235 Lowest Common Ancestor of a Binary Search Tree Medium297 Serialize and Deserialize Binary Tree Hard572 Subtree of Another Tree Easy
All Binary Tree problems
94 Binary Tree Inorder Traversal Easy95 Unique Binary Search Trees II Medium96 Unique Binary Search Trees Medium98 Validate Binary Search Tree Medium99 Recover Binary Search Tree Medium100 Same Tree Easy101 Symmetric Tree Easy102 Binary Tree Level Order Traversal Medium103 Binary Tree Zigzag Level Order Traversal Medium104 Maximum Depth of Binary Tree Easy105 Construct Binary Tree from Preorder and Inorder Traversal Medium106 Construct Binary Tree from Inorder and Postorder Traversal Medium107 Binary Tree Level Order Traversal II Medium108 Convert Sorted Array to Binary Search Tree Easy109 Convert Sorted List to Binary Search Tree Medium110 Balanced Binary Tree Easy111 Minimum Depth of Binary Tree Easy112 Path Sum Easy113 Path Sum II Medium114 Flatten Binary Tree to Linked List Medium116 Populating Next Right Pointers in Each Node Medium117 Populating Next Right Pointers in Each Node II Medium124 Binary Tree Maximum Path Sum Hard129 Sum Root to Leaf Numbers Medium144 Binary Tree Preorder Traversal Easy145 Binary Tree Postorder Traversal Easy173 Binary Search Tree Iterator Medium199 Binary Tree Right Side View Medium222 Count Complete Tree Nodes Easy226 Invert Binary Tree Easy230 Kth Smallest Element in a BST Medium235 Lowest Common Ancestor of a Binary Search Tree Medium236 Lowest Common Ancestor of a Binary Tree Medium257 Binary Tree Paths Easy297 Serialize and Deserialize Binary Tree Hard331 Verify Preorder Serialization of a Binary Tree Medium337 House Robber III Medium404 Sum of Left Leaves Easy437 Path Sum III Medium449 Serialize and Deserialize BST Medium450 Delete Node in a BST Medium501 Find Mode in Binary Search Tree Easy508 Most Frequent Subtree Sum Medium513 Find Bottom Left Tree Value Medium515 Find Largest Value in Each Tree Row Medium530 Minimum Absolute Difference in BST Easy538 Convert BST to Greater Tree Medium543 Diameter of Binary Tree Easy563 Binary Tree Tilt Easy572 Subtree of Another Tree Easy606 Construct String from Binary Tree Medium617 Merge Two Binary Trees Easy623 Add One Row to Tree Medium637 Average of Levels in Binary Tree Easy652 Find Duplicate Subtrees Medium653 Two Sum IV - Input is a BST Easy654 Maximum Binary Tree Medium655 Print Binary Tree Medium662 Maximum Width of Binary Tree Medium669 Trim a Binary Search Tree Medium671 Second Minimum Node In a Binary Tree Easy687 Longest Univalue Path Medium700 Search in a Binary Search Tree Easy701 Insert into a Binary Search Tree Medium703 Kth Largest Element in a Stream Easy783 Minimum Distance Between BST Nodes Easy814 Binary Tree Pruning Medium863 All Nodes Distance K in Binary Tree Medium865 Smallest Subtree with all the Deepest Nodes Medium872 Leaf-Similar Trees Easy889 Construct Binary Tree from Preorder and Postorder Traversal Medium894 All Possible Full Binary Trees Medium897 Increasing Order Search Tree Easy919 Complete Binary Tree Inserter Medium938 Range Sum of BST Easy951 Flip Equivalent Binary Trees Medium958 Check Completeness of a Binary Tree Medium965 Univalued Binary Tree Easy968 Binary Tree Cameras Hard971 Flip Binary Tree To Match Preorder Traversal Medium979 Distribute Coins in Binary Tree Medium987 Vertical Order Traversal of a Binary Tree Hard988 Smallest String Starting From Leaf Medium993 Cousins in Binary Tree Easy998 Maximum Binary Tree II Medium1008 Construct Binary Search Tree from Preorder Traversal Medium1022 Sum of Root To Leaf Binary Numbers Easy1026 Maximum Difference Between Node and Ancestor Medium1028 Recover a Tree From Preorder Traversal Hard1038 Binary Search Tree to Greater Sum Tree Medium1080 Insufficient Nodes in Root to Leaf Paths Medium1104 Path In Zigzag Labelled Binary Tree Medium1110 Delete Nodes And Return Forest Medium1123 Lowest Common Ancestor of Deepest Leaves Medium1145 Binary Tree Coloring Game Medium1161 Maximum Level Sum of a Binary Tree Medium1261 Find Elements in a Contaminated Binary Tree Medium1302 Deepest Leaves Sum Medium1305 All Elements in Two Binary Search Trees Medium1315 Sum of Nodes with Even-Valued Grandparent Medium1325 Delete Leaves With a Given Value Medium1339 Maximum Product of Splitted Binary Tree Medium1361 Validate Binary Tree Nodes Medium1367 Linked List in Binary Tree Medium1372 Longest ZigZag Path in a Binary Tree Medium1373 Maximum Sum BST in Binary Tree Hard1379 Find a Corresponding Node of a Binary Tree in a Clone of That Tree Easy1382 Balance a Binary Search Tree Medium1448 Count Good Nodes in Binary Tree Medium1457 Pseudo-Palindromic Paths in a Binary Tree Medium1530 Number of Good Leaf Nodes Pairs Medium1569 Number of Ways to Reorder Array to Get Same BST Hard1609 Even Odd Tree Medium1932 Merge BSTs to Create Single BST Hard2049 Count Nodes With the Highest Score Medium2096 Step-By-Step Directions From a Binary Tree Node to Another Medium2196 Create Binary Tree From Descriptions Medium2236 Root Equals Sum of Children Easy2265 Count Nodes Equal to Average of Subtree Medium2331 Evaluate Boolean Binary Tree Easy2385 Amount of Time for Binary Tree to Be Infected Medium2415 Reverse Odd Levels of Binary Tree Medium2458 Height of Binary Tree After Subtree Removal Queries Hard2471 Minimum Number of Operations to Sort a Binary Tree by Level Medium2476 Closest Nodes Queries in a Binary Search Tree Medium2509 Cycle Length Queries in a Tree Hard2583 Kth Largest Sum in a Binary Tree Medium2641 Cousins in Binary Tree II Medium2673 Make Costs of Paths Equal in a Binary Tree Medium3319 K-th Largest Perfect Subtree Size in Binary Tree Medium