Count nodes in a BST that lies within a given range
Given a BST, count the total number of nodes that lie within a given range.
Ace your Coding Interview
Get hired by top tech companies with our comprehensive interview preparation.
Get StartedGiven a BST, count the total number of nodes that lie within a given range.
Given a linked list, construct a complete binary tree from it. Assume that the order of elements present in the linked list is the same as that in the complete tree’s array representation.
Given a binary tree, check if removing an edge can split it into two binary trees of equal size.
Given an array representing the preorder traversal of a BST, determine whether it represents a skewed BST or not. In a skewed BST, each node’s descendants are either smaller or larger than the node itself.
Given an integer representing the capacity of a cyber cafe and a sequence representing entry/exit logs of customers, find the total number of customers who could not get any computer.
Given a list of departure and arrival airports, find the itinerary in order. It may be assumed that departure is scheduled from every airport except the final destination, and each airport is visited only once.
Evaluate a given binary expression tree representing algebraic expressions. A binary expression tree is a binary tree, where the operators are stored in the tree’s internal nodes, and the leaves contain constants.
Given a binary tree, check if each node has exactly one child or not. In other words, check whether the binary tree is skewed or not.
Given an array, count the total number of triplets, which leads to an inversion. If (i < j < k) and (A[i] > A[j] > A[k]), then we can say that triplet (i, j, k) formed an inversion in an array A.
Given n ropes of different lengths, connect them into a single rope with minimum cost. Assume that the cost to connect two ropes is the same as the sum of their lengths.
Construct an expression tree from a given postfix notation and print the infix notation. The binary expression tree is a binary tree whose leaves are operands, such as constants or variable names, and the other nodes contain operators.
Given a level order representation of a complete binary search tree, print its elements in increasing order.