Skip to content

Category Archives: Recursion

Given an array arr[] of size N and an integer K, the task is to print all possible ways to split the given array into… Read More
Given an array arr[] consisting of a single element N (1 ≤ N ≤ 106) and two integers L and R, ( 1 ≤ L… Read More
Given an integer N, the task is to count the number of ways to represent N as the sum of powers of 2. Examples: Input:… Read More
Given an array arr[] consisting of 2* N elements in the form of { a1, a2, …, aN, b1, b2, …, bN }, the task… Read More
Given a XOR linked list and an integer K, the task is to reverse every K nodes in the given XOR linked list. Examples: Input:… Read More
Given three arrays A[], B[] and C[] of size N and three positive integers X, Y, and Z, the task is to find the maximum… Read More
Given a list arr[] consisting of arrays of varying lengths, the task is to find the maximum product that can be formed by taking exactly… Read More
Given three integers N, A, and B, the task is to calculate the probability that the sum of numbers obtained on throwing the dice exactly… Read More
Given a Binary Tree, the task is to find the most frequent subtree sum that can be obtained by considering every node of the given… Read More
Given a Binary Tree, the task is to find the smallest subtree that contains all the deepest nodes of the given Binary Tree and return… Read More
Given a Binary Tree consisting of N nodes, the task to find the maximum average of values of nodes of any subtree. Examples:  Input:   … Read More
Given a Binary Tree, the task is to remove the leaf nodes of the Binary Tree during each operation and print the count. Examples: Input:  … Read More
Given an integer N, the task is to count the number of N-length strings consisting of lowercase vowels that can be generated based the following… Read More
Given an N-Ary tree, the task is to print all root to leaf paths of the given N-ary Tree. Examples: Input:         … Read More