Skip to content

Category Archives: Recursion

Given a Binary Tree and an integer D, the task is to check if the distance between all pairs of the same node values in… Read More
Given a tree with N nodes value from 1 to N and (N – 1) Edges and a number K, the task is to remove… Read More
Given an undirected graph consisting of N vertices and M edges and queries Q[][] of the type {X, Y}, the task is to check if… Read More
Find the largest possible string of distinct characters formed using a combination of given strings. Any given string has to be chosen completely or not… Read More
Given a Tree consisting of N nodes having values in the range [0, N – 1] and (N – 1) edges, and two nodes X… Read More
Given a Binary Tree consisting of N nodes, the task is to print its Mix Order Traversal.  Mix Order Traversal is a tree traversal technique,… Read More
Given an integer N, the task is to count the minimum steps required to reduce the value of N to 0 by performing the following… Read More
Given a numerical string S, the task is to print all the permutations of the string which are divisible by N. Examples: Input: N =… Read More
Given a number N, the task is to calculate the total number of corresponding different bit in the binary representation for every consecutive number from… Read More
Given a Tree consisting of N vertices, rooted at vertex 1 and an array val[] representing the values assigned to each vertex, and an array… Read More
Given a Tree, the task is to find the farthest node from each node to another node in the given tree. Examples   Input:  Output: 2… Read More
Given a binary matrix mat[][], the task is to find the size of all possible non-empty connected cells.  An empty cell is denoted by 0… Read More
Given a rooted tree having N vertices, an array values[ ], which represents the value assigned to each node, and a vertex V, the task… Read More
Given an integer N, the task is to find the Landau’s Function of the number N. In number theory, The Landau’s function finds the largest… Read More
Given an N-ary Tree rooted at 1, and an array val[] consisting of weights assigned to every node, and a matrix Q[][], consisting of queries… Read More