Binary Tree DSA Problems

169 binary tree problems for coding interviews and campus placements, with hints and company tags. Below are the first 100 of 169: 38 easy, 48 medium and 14 hard. Practise them free on InternHack and track what you have solved.

Binary Tree problems, easiest first

  1. Average of Levels in Binary Tree (Easy)
  2. Balanced Binary Tree (Easy)
  3. Binary Tree Inorder Traversal (Easy)
  4. Binary Tree Paths (Easy)
  5. Binary Tree Postorder Traversal (Easy)
  6. Binary Tree Preorder Traversal (Easy)
  7. Binary Tree Tilt (Easy)
  8. Closest Binary Search Tree Value (Easy)
  9. Convert Sorted Array to Binary Search Tree (Easy)
  10. Count Complete Tree Nodes (Easy)
  11. Cousins in Binary Tree (Easy)
  12. Diameter of Binary Tree (Easy)
  13. Evaluate Boolean Binary Tree (Easy)
  14. Extract Kth Character From The Rope Tree (Easy)
  15. Find a Corresponding Node of a Binary Tree in a Clone of That Tree (Easy)
  16. Find All The Lonely Nodes (Easy)
  17. Find Mode in Binary Search Tree (Easy)
  18. Increasing Order Search Tree (Easy)
  19. Invert Binary Tree (Easy)
  20. Kth Largest Element in a Stream (Easy)
  21. Leaf-Similar Trees (Easy)
  22. Maximum Depth of Binary Tree (Easy)
  23. Merge Two Binary Trees (Easy)
  24. Minimum Absolute Difference in BST (Easy)
  25. Minimum Depth of Binary Tree (Easy)
  26. Minimum Distance Between BST Nodes (Easy)
  27. Path Sum (Easy)
  28. Range Sum of BST (Easy)
  29. Root Equals Sum of Children (Easy)
  30. Same Tree (Easy)
  31. Search in a Binary Search Tree (Easy)
  32. Second Minimum Node In a Binary Tree (Easy)
  33. Subtree of Another Tree (Easy)
  34. Sum of Left Leaves (Easy)
  35. Sum of Root To Leaf Binary Numbers (Easy)
  36. Symmetric Tree (Easy)
  37. Two Sum IV - Input is a BST (Easy)
  38. Univalued Binary Tree (Easy)
  39. Add One Row to Tree (Medium)
  40. All Elements in Two Binary Search Trees (Medium)
  41. All Nodes Distance K in Binary Tree (Medium)
  42. All Possible Full Binary Trees (Medium)
  43. Amount of Time for Binary Tree to Be Infected (Medium)
  44. Balance a Binary Search Tree (Medium)
  45. Binary Search Tree Iterator (Medium)
  46. Binary Search Tree Iterator II (Medium)
  47. Binary Search Tree to Greater Sum Tree (Medium)
  48. Binary Tree Coloring Game (Medium)
  49. Binary Tree Level Order Traversal (Medium)
  50. Binary Tree Level Order Traversal II (Medium)
  51. Binary Tree Longest Consecutive Sequence (Medium)
  52. Binary Tree Longest Consecutive Sequence II (Medium)
  53. Binary Tree Pruning (Medium)
  54. Binary Tree Right Side View (Medium)
  55. Binary Tree Upside Down (Medium)
  56. Binary Tree Vertical Order Traversal (Medium)
  57. Binary Tree Zigzag Level Order Traversal (Medium)
  58. Boundary of Binary Tree (Medium)
  59. Change the Root of a Binary Tree (Medium)
  60. Check Completeness of a Binary Tree (Medium)
  61. Check If Two Expression Trees are Equivalent (Medium)
  62. Clone Binary Tree With Random Pointer (Medium)
  63. Closest Leaf in a Binary Tree (Medium)
  64. Closest Nodes Queries in a Binary Search Tree (Medium)
  65. Complete Binary Tree Inserter (Medium)
  66. Construct Binary Search Tree from Preorder Traversal (Medium)
  67. Construct Binary Tree from Inorder and Postorder Traversal (Medium)
  68. Construct Binary Tree from Preorder and Inorder Traversal (Medium)
  69. Construct Binary Tree from Preorder and Postorder Traversal (Medium)
  70. Construct Binary Tree from String (Medium)
  71. Construct String from Binary Tree (Medium)
  72. Convert Binary Search Tree to Sorted Doubly Linked List (Medium)
  73. Convert BST to Greater Tree (Medium)
  74. Convert Sorted List to Binary Search Tree (Medium)
  75. Correct a Binary Tree (Medium)
  76. Count Good Nodes in Binary Tree (Medium)
  77. Count Nodes Equal to Average of Subtree (Medium)
  78. Count Nodes Equal to Sum of Descendants (Medium)
  79. Count Nodes With the Highest Score (Medium)
  80. Count Univalue Subtrees (Medium)
  81. Cousins in Binary Tree II (Medium)
  82. Create Binary Tree From Descriptions (Medium)
  83. Deepest Leaves Sum (Medium)
  84. Delete Leaves With a Given Value (Medium)
  85. Delete Node in a BST (Medium)
  86. Delete Nodes And Return Forest (Medium)
  87. Binary Tree Cameras (Hard)
  88. Binary Tree Maximum Path Sum (Hard)
  89. Build Binary Expression Tree From Infix Expression (Hard)
  90. Closest Binary Search Tree Value II (Hard)
  91. Cycle Length Queries in a Tree (Hard)
  92. Height of Binary Tree After Subtree Removal Queries (Hard)
  93. Maximum Sum BST in Binary Tree (Hard)
  94. Merge BSTs to Create Single BST (Hard)
  95. Minimum Flips in Binary Tree to Get Result (Hard)
  96. Number of Ways to Reorder Array to Get Same BST (Hard)
  97. Recover a Tree From Preorder Traversal (Hard)
  98. Serialize and Deserialize Binary Tree (Hard)
  99. Subtree Removal Game with Fibonacci Tree (Hard)
  100. Vertical Order Traversal of a Binary Tree (Hard)

Companies that ask binary tree problems

Before your interview

Most resumes are filtered by software before a recruiter reads them. Check your resume ATS score free, no signup needed.

Other DSA topics