Binary Search Tree Problems
Master binary search tree problems with AI-powered solutions. Get instant coding assistance during your technical interviews for all 29 problems in this category.
Total Problems: 29
Easy: 9
Medium: 18
Hard: 2
Showing 29 of 29 problems
Problems
Scroll within this area to browse all problems
#
Title
Difficulty
Binary Search Tree LeetCode Problems List
- 98. Validate Binary Search Tree - Medium - Binary Search TreeGiven the root of a binary tree, determine if it is a valid binary search tree (BST). A valid BST is defined as follows: The left subtree of a node co... Topics: Tree, Depth-First Search, Binary Search Tree, Binary Tree
- 235. Lowest Common Ancestor of a Binary Search Tree - Medium - Binary Search TreeGiven a binary search tree (BST), find the lowest common ancestor (LCA) node of two given nodes in the BST. According to the definition of LCA on Wiki... Topics: Tree, Depth-First Search, Binary Search Tree, Binary Tree
- 108. Convert Sorted Array to Binary Search Tree - Easy - Binary Search TreeGiven an integer array nums where the elements are sorted in ascending order, convert it to a height-balanced binary search tree.... Topics: Array, Divide and Conquer, Tree, Binary Search Tree, Binary Tree
- 450. Delete Node in a BST - Medium - Binary Search TreeGiven a root node reference of a BST and a key, delete the node with the given key in the BST. Return the root node reference (possibly updated) of th... Topics: Tree, Binary Search Tree, Binary Tree
- 653. Two Sum IV - Input is a BST - Easy - Binary Search TreeGiven the root of a binary search tree and an integer k, return true if there exist two elements in the BST such that their sum is equal to k, or fals... Topics: Hash Table, Two Pointers, Tree, Depth-First Search, Breadth-First Search, Binary Search Tree, Binary Tree
- 230. Kth Smallest Element in a BST - Medium - Binary Search TreeGiven the root of a binary search tree, and an integer k, return the kth smallest value (1-indexed) of all the values of the nodes in the tree.... Topics: Tree, Depth-First Search, Binary Search Tree, Binary Tree
- 784. Insert into a Binary Search Tree - Medium - Binary Search TreeYou are given the root node of a binary search tree (BST) and a value to insert into the tree. Return the root node of the BST after the insertion. It... Topics: Tree, Binary Search Tree, Binary Tree
- 96. Unique Binary Search Trees - Medium - Binary Search TreeGiven an integer n, return the number of structurally unique BST's (binary search trees) which has exactly n nodes of unique values from 1 to n.... Topics: Math, Dynamic Programming, Tree, Binary Search Tree, Binary Tree
- 1285. Balance a Binary Search Tree - Medium - Binary Search TreeGiven the root of a binary search tree, return a balanced binary search tree with the same node values. If there is more than one answer, return any o... Topics: Divide and Conquer, Greedy, Tree, Depth-First Search, Binary Search Tree, Binary Tree
- 99. Recover Binary Search Tree - Medium - Binary Search TreeYou are given the root of a binary search tree (BST), where the values of exactly two nodes of the tree were swapped by mistake. Recover the tree with... Topics: Tree, Depth-First Search, Binary Search Tree, Binary Tree
- 783. Search in a Binary Search Tree - Easy - Binary Search TreeYou are given the root of a binary search tree (BST) and an integer val. Find the node in the BST that the node's value equals val and return the subt... Topics: Tree, Binary Search Tree, Binary Tree
- 975. Range Sum of BST - Easy - Binary Search TreeGiven the root node of a binary search tree and two integers low and high, return the sum of values of all nodes with a value in the inclusive range [... Topics: Tree, Depth-First Search, Binary Search Tree, Binary Tree
- 530. Minimum Absolute Difference in BST - Easy - Binary Search TreeGiven the root of a Binary Search Tree (BST), return the minimum absolute difference between the values of any two different nodes in the tree.... Topics: Tree, Depth-First Search, Breadth-First Search, Binary Search Tree, Binary Tree
- 173. Binary Search Tree Iterator - Medium - Binary Search TreeImplement the BSTIterator class that represents an iterator over the in-order traversal of a binary search tree (BST): BSTIterator(TreeNode root) Init... Topics: Stack, Tree, Design, Binary Search Tree, Binary Tree, Iterator
- 109. Convert Sorted List to Binary Search Tree - Medium - Binary Search TreeGiven the head of a singly linked list where elements are sorted in ascending order, convert it to a height-balanced binary search tree.... Topics: Linked List, Divide and Conquer, Tree, Binary Search Tree, Binary Tree
- 789. Kth Largest Element in a Stream - Easy - Binary Search TreeYou are part of a university admissions office and need to keep track of the kth highest test score from applicants in real-time. This helps to determ... Topics: Tree, Design, Binary Search Tree, Heap (Priority Queue), Binary Tree, Data Stream
- 95. Unique Binary Search Trees II - Medium - Binary Search TreeGiven an integer n, return all the structurally unique BST's (binary search trees), which has exactly n nodes of unique values from 1 to n. Return the... Topics: Dynamic Programming, Backtracking, Tree, Binary Search Tree, Binary Tree
- 1050. Construct Binary Search Tree from Preorder Traversal - Medium - Binary Search TreeGiven an array of integers preorder, which represents the preorder traversal of a BST (i.e., binary search tree), construct the tree and return its ro... Topics: Array, Stack, Tree, Binary Search Tree, Monotonic Stack, Binary Tree
- 2567. Closest Nodes Queries in a Binary Search Tree - Medium - Binary Search TreeYou are given the root of a binary search tree and an array queries of size n consisting of positive integers. Find a 2D array answer of size n where ... Topics: Array, Binary Search, Tree, Depth-First Search, Binary Search Tree, Binary Tree
- 449. Serialize and Deserialize BST - Medium - Binary Search TreeSerialization is converting a data structure or object into a sequence of bits so that it can be stored in a file or memory buffer, or transmitted acr... Topics: String, Tree, Depth-First Search, Breadth-First Search, Design, Binary Search Tree, Binary Tree
- 1114. Binary Search Tree to Greater Sum Tree - Medium - Binary Search TreeGiven the root of a Binary Search Tree (BST), convert it to a Greater Tree such that every key of the original BST is changed to the original key plus... Topics: Tree, Depth-First Search, Binary Search Tree, Binary Tree
- 538. Convert BST to Greater Tree - Medium - Binary Search TreeGiven the root of a Binary Search Tree (BST), convert it to a Greater Tree such that every key of the original BST is changed to the original key plus... Topics: Tree, Depth-First Search, Binary Search Tree, Binary Tree
- 1427. All Elements in Two Binary Search Trees - Medium - Binary Search TreeGiven two binary search trees root1 and root2, return a list containing all the integers from both trees sorted in ascending order.... Topics: Tree, Depth-First Search, Binary Search Tree, Sorting, Binary Tree
- 669. Trim a Binary Search Tree - Medium - Binary Search TreeGiven the root of a binary search tree and the lowest and highest boundaries as low and high, trim the tree so that all its elements lies in [low, hig... Topics: Tree, Depth-First Search, Binary Search Tree, Binary Tree
- 501. Find Mode in Binary Search Tree - Easy - Binary Search TreeGiven the root of a binary search tree (BST) with duplicates, return all the mode(s) (i.e., the most frequently occurred element) in it. If the tree h... Topics: Tree, Depth-First Search, Binary Search Tree, Binary Tree
- 1692. Number of Ways to Reorder Array to Get Same BST - Hard - Binary Search TreeGiven an array nums that represents a permutation of integers from 1 to n. We are going to construct a binary search tree (BST) by inserting the eleme... Topics: Array, Math, Divide and Conquer, Dynamic Programming, Tree, Union Find, Binary Search Tree, Memoization, Combinatorics, Binary Tree
- 799. Minimum Distance Between BST Nodes - Easy - Binary Search TreeGiven the root of a Binary Search Tree (BST), return the minimum difference between the values of any two different nodes in the tree.... Topics: Tree, Depth-First Search, Breadth-First Search, Binary Search Tree, Binary Tree
- 933. Increasing Order Search Tree - Easy - Binary Search TreeGiven the root of a binary search tree, rearrange the tree in in-order so that the leftmost node in the tree is now the root of the tree, and every no... Topics: Stack, Tree, Depth-First Search, Binary Search Tree, Binary Tree
- 1475. Maximum Sum BST in Binary Tree - Hard - Binary Search TreeGiven a binary tree root, return the maximum sum of all keys of any sub-tree which is also a Binary Search Tree (BST). Assume a BST is defined as foll... Topics: Dynamic Programming, Tree, Depth-First Search, Binary Search Tree, Binary Tree
Related LeetCode Topics
- Array LeetCode Problems
- Backtracking LeetCode Problems
- Biconnected Component LeetCode Problems
- Binary Indexed Tree LeetCode Problems
- Binary Search LeetCode Problems
- Binary Tree LeetCode Problems
- Bit Manipulation LeetCode Problems
- Bitmask LeetCode Problems
- Brainteaser LeetCode Problems
- Breadth-First Search LeetCode Problems
- Bucket Sort LeetCode Problems
- Combinatorics LeetCode Problems
- Concurrency LeetCode Problems
- Counting LeetCode Problems
- Counting Sort LeetCode Problems
- Data Stream LeetCode Problems
- Database LeetCode Problems
- Depth-First Search LeetCode Problems
- Design LeetCode Problems
- Divide and Conquer LeetCode Problems