Skip to content

# Category Archives: Recursion

Given an undirected Graph consisting of N nodes in the form of an adjacency matrix graph[][] of size N*N, the task is to print all… Read More
Given a Binary Tree consisting of N nodes, the task is to find the length of the longest path from any node to the bottom… Read More
Given an array arr[] consisting of N integers, the task is to find the maximum Bitwise XOR of Bitwise OR of every subarray after splitting… Read More
Given an integer N, the task is to count the number of N-digit numbers such that each digit, except the first and second digits, is… Read More
Given an integer N, the task is to count the number of pairs (X, Y) such that X + Y = X ^ Y and… Read More
Given a string S of size N consisting of characters a, b, and c only, the task is to find the number of substrings of… Read More
Given an array arr[] consisting of N integers, the task is to sort the given array in ascending order using the slow sort. Examples: Input:… Read More
Given the head of the linked list representing a positive integer, the task is to print the updated linked list after subtracting 1 from it.… Read More
Given an array arr[] consisting of N integers and an integer M (initially 1), the task is to find the maximum sum of array elements… Read More
Given an integer N, the task is to find the number of ways to represent the number N as sum of perfect squares. Examples: Input:… Read More
Given two numbers N and M, the task is to find the number of sorted arrays that can be formed of size M using first… Read More
Given a stack S and an integer N, the task is to insert N at the bottom of the stack. Examples: Input: N = 7S =… Read More
Given a Binary Tree, the task is to construct an array such that ith index of the array contains GCD of all the nodes present… Read More
Given a Binary Tree consisting of N nodes, the task is to replace each node of the tree with the product of all the remaining… Read More
Given a Binary Tree consisting of N nodes, the task is to find the minimum number of cameras required to monitor the entire tree such… Read More