Find number of customers who could not get any computer
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.
Ace your Coding Interview
Get hired by top tech companies with our comprehensive interview preparation.
Get StartedGiven 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.
Given a binary tree, find its minimum depth. The minimum depth is the total number of nodes along the shortest path from the root node down to the nearest leaf node.
Given a list containing future price predictions of two different stocks for the next n–days, find the maximum profit earned by selling the stocks with a constraint that the second stock can be sold, only if no transaction happened on the previous day for any of the stock.
An m-ary tree is a tree in which each node has no more than m children. Given an m-ary tree, write an efficient algorithm to convert the tree to its mirror.
Given a valid roman numeral, convert it to the corresponding integer value.