Binary Search Tree LeetCode Problems: All 40,
With Python Solutions

Every problem in this library that LeetCode tags Binary Search Tree. 29 of them carry a complete Python solution, a worked example and the time and space complexity of the approach.

Easy
10
Medium
27
Hard
3
1 pattern

How Binary Search Tree problems are solved

A tag names the subject, not the method. These pattern hubs cover the techniques that actually solve Binary Search Tree problems — each one explains the approach, gives a Python template and states its complexity.

Eyes only

When the Binary Search Tree problem arrives live.

In the live round, Stealth Interview reads the problem off your screen, returns a working solution with a step-by-step explanation and its time and space complexity, and transcribes what the interviewer says. It's a desktop app for macOS and Windows, invisible to screen sharing.

Binary Search Tree problems by difficulty

Problems with a complete Python solution are listed first, then by ascending problem number.

Easy (10)

Easy problems
No.Problem
0108Convert Sorted Array to Binary Search Tree
0501Find Mode in Binary Search Tree
0530Minimum Absolute Difference in BST
0653Two Sum IV - Input is a BST
0700Search in a Binary Search Tree
0703Kth Largest Element in a Stream
0783Minimum Distance Between BST Nodes
0897Increasing Order Search Tree
0938Range Sum of BST
0270Closest Binary Search Tree ValuePremium

Medium (27)

Medium problems
No.Problem
0095Unique Binary Search Trees II
0096Unique Binary Search Trees
0098Validate Binary Search Tree
0099Recover Binary Search Tree
0109Convert Sorted List to Binary Search Tree
0173Binary Search Tree Iterator
0230Kth Smallest Element in a BST
0235Lowest Common Ancestor of a Binary Search Tree
0449Serialize and Deserialize BST
0450Delete Node in a BST
0538Convert BST to Greater Tree
0669Trim a Binary Search Tree
0701Insert into a Binary Search Tree
1008Construct Binary Search Tree from Preorder Traversal
1038Binary Search Tree to Greater Sum Tree
1305All Elements in Two Binary Search Trees
1382Balance a Binary Search Tree
2476Closest Nodes Queries in a Binary Search Tree
0255Verify Preorder Sequence in Binary Search TreePremium
0285Inorder Successor in BSTPremium
0333Largest BST SubtreePremium
0426Convert Binary Search Tree to Sorted Doubly Linked ListPremium
0510Inorder Successor in BST IIPremium
0776Split BSTPremium
1214Two Sum BSTsPremium
1586Binary Search Tree Iterator IIPremium
1902Depth of BST Given Insertion OrderPremium

Hard (3)

Hard problems
No.Problem
1373Maximum Sum BST in Binary Tree
1569Number of Ways to Reorder Array to Get Same BST
0272Closest Binary Search Tree Value IIPremium