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
ProDeveloperTutorialonAugust 29, 2026 Binary Search Trees: Check If Preorder Traversal Is Valid BST Problem Statement: You are given a array, you need to check if array can be represented as pre-order of BST. BST is a tree that satisfies… Discover More
ProDeveloperTutorialonAugust 29, 2026 Binary Search Trees: Given a sorted linked list into binary search tree Problem Statement: Given a sorted linked list into binary search tree Example: Input: 1 -> 2 -> 3 Output: 2 / \ 1 3 [[2], [1,3]] … Discover More