Skip to content

Category Archives: Recursion

Given a Directed Graph consisting of N vertices and M edges and a set of Edges[][], the task is to check whether the graph contains… Read More
Given a number N and a prime number P, the task is to find the sum of the largest divisors of each number in the… Read More
Given string str, the task is to write a recursive program to remove all the occurrences of a character X in the string. Examples: Input:… Read More
Given two numbers A and B, the task is to find the sum of the given two numbers.Examples:  Input: A = 5, B = 6 Output:… Read More
Given two integers [L, R], the task is to count the number of Primonacci Numbers in the range [L, R].  Primonacci Series: F(1) = F(2) =… Read More
Given an integer N, the task is to obtain N, starting from 1 using minimum number of operations. The operations that can be performed in… Read More
Given two integers V and E representing the number of vertices and edges of an undirected graph G(V, E), a list of edges EdgeList, and… Read More
Given a Generic tree, the task is to delete the leaf nodes from the tree.  Examples: Input: 5 / / \ \ 1 2 3… Read More
Given two Binary Trees, the task is to create a Maximum Binary Tree from the two given binary trees and print the Inorder Traversal of… Read More
Given an array arr[] consisting of integers and queries Q of the form (L, R), the task is to check whether any non-repeating element is… Read More
Given an integer N, the task is to print all the possible ways in which N can be written as the sum of two or… Read More
Given an Undirected Graph consisting of N vertices and M edges, where node values are in the range [1, N], and vertices specified by the… Read More
Given a matrix board[][] consisting of the characters K or k, Q or q, B or b, N or n, R or r, and P… Read More
Given a Directed graph of N vertices and M edges, the task is to find the minimum number of edges required to make the given… Read More