Count decodings of a given sequence of digits
Given a positive number, map its digits to the corresponding alphabet in the mapping table, and return the count of the total number of decodings possible.
Ace your Coding Interview
Get hired by top tech companies with our comprehensive interview preparation.
Get StartedGiven a positive number, map its digits to the corresponding alphabet in the mapping table, and return the count of the total number of decodings possible.
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 a binary tree, perform the boundary traversal of it. The solution should print the boundary nodes starting from the root of the tree, in an anti-clockwise direction, without any duplicates.
Given a directed graph, check if it is possible to construct a cycle that visits each edge exactly once, i.e., check whether the graph has an Eulerian cycle or not.
Write an efficient algorithm to fix the children-sum property in a given binary tree. The only operation allowed is an increment operation on the node’s value.
Given an array of words where no word is the prefix of another, find the shortest unique prefix to identify each word in the array uniquely.
Given two binary trees, check whether the leaf traversals of both trees are the same or not.
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 binary tree, extract all its leaves into a doubly-linked list, i.e., remove all leaf nodes from the binary tree and construct a doubly linked list out of them.
Given a binary tree, write an efficient algorithm to find the maximum path sum between any two nodes in it. The path can start and end at any node in the tree and need not go through the root.
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.