ProDeveloperTutorialonAugust 29, 2026 Binary Search Trees: Given a BST, remove all the leaf nodes Problem Statement: Given a BST, remove all the leaf nodes Example: Input: /* * 10 * / \ * 8 12 * / \ / \ * 2 9 11 14 */ Output: /* * 10 * / \… Discover More
ProDeveloperTutorialonAugust 29, 2026 Binary Search Trees: Given 2 BST, check if both contain same set of elements Problem Statement: Given 2 BST, check if both contain same set of elements Example: Input: /* * 10 * / \ * 8 12 * / \ / \ * 2 9 11 14 */ /* *… Discover More
ProDeveloperTutorialonAugust 29, 2026 Binary Search Trees: Given a BST, find median in BST Problem Statement: Given a BST, find the median Example: Input: /* * 10 * / \ * 8 12 * / \ / \ * 2 9 11 14 */ Output: 10 Solution Explanation:… Discover More
ProDeveloperTutorialonAugust 29, 2026 Binary Search Trees: Given two BST, print all elements Problem Statement: Given two BST, print all elements in sorted order Example: Input: /* * 10 * / \ * 8 12 * / \ / \ * 2 9 11 14 */ /* * 10 * /… Discover More
ProDeveloperTutorialonAugust 29, 2026 Binary Search Trees: Given a BST and a range, return the range sum of that BST Problem Statement: Given a BST and a range [low, high], return the range sum of that BST Example: Input: /* * 10 * / \ * 8 12 * / \ / \ * 2 9… Discover More
ProDeveloperTutorialonAugust 29, 2026 Binary Search Trees: Given a BST and a key, find the next greater element of that key Problem Statement: Given a BST and a key, find the next greater element of that key Example: Input: /* * 10 * / \ * 8 12 * / \ / \ * 2 9 11 14… Discover More
ProDeveloperTutorialonAugust 29, 2026 Binary Search Trees: Given a BST and a key, find the next smaller element of that key Problem Statement: Given a BST and a key, find the next smaller element of that key Example: Input: /* * 10 * / \ * 8 12 * / \ / \ * 2 9 11 14… Discover More
ProDeveloperTutorialonAugust 29, 2026 Binary Search Trees: Given 2 BST, check if it has same set of elements or not Problem Statement: You are given 2 BST. You need to check if 2 BST has same set of elements or not Structure of 2 BST can be different BST is… Discover More
ProDeveloperTutorialonAugust 29, 2026 Binary Search Trees: Given a BST, check if each internal node has only one child Problem Statement: You are given an array in pre-order traversal of BST. You need to check if non leaf node has only one child. BST will have… Discover More
ProDeveloperTutorialonAugust 29, 2026 Binary Search Trees: Given an array, check if it represents inorder traversal of BST. Problem Statement: You are given an array, you need to check if can be represented as in order traversal of BST. BST is a tree that satisfies… Discover More