Given a number N and a mapping of letters to each integer from 1 to 8, which are: {1: ‘abc’, 2: ‘def’, 3: ‘ghi’, 4: ‘jkl’,… Read More

# Category Archives: Recursion

Given a directed graph with N nodes and M edges in array V[], the task is to find the number of nodes that are accessible… Read More

Given an undirected tree with N nodes numbered from 1 to N and an array A[] where A[i] denotes the value assigned to (i+1)th node.… Read More

Given a string S of length N, the task is to find the number of unique subsequences of the string for each length from 0… Read More

Given a Binary tree, the task is to print the outer cone layer i.e. combination of layers formed by moving only through the left child… Read More

Given a tree with N vertices and N-1 edges represented by a 2D array edges[], the task is to find the minimum value among the… Read More

Given a binary tree, a target node and a positive integer K on it, the task is to find the sum of all nodes within… Read More

Given a Binary search tree having N nodes, the task is to find all the paths starting at the root and ending at any leaf… Read More

Given an N-ary Tree. The task is to print the level order traversal of the tree where each level will be in a new line.… Read More

Given a connected acyclic graph with N nodes numbered from 1 to N and N-1 edges, find out the pair of nodes that are at… Read More

Given an array arr[] of length N (N > 1)containing positive integers, the task is to encrypt the numbers of the array into a single… Read More

Given a binary tree, the task is to print all the nodes of the binary tree in Pre-order, Post-order, and In-order in one iteration. Examples:… Read More

Given two integers N and M, the task is to find the Mth lexicographically smallest binary string (have only characters 1 and 0) of length… Read More

Given a full binary tree where each node value is the same as the minimum value between its children, the task is to find the… Read More

Given a directed binary tree of N nodes whose edges are directed from the parent to the child, the task is to count the number… Read More