Given an array arr[] consisting of N integers and an integer K, the task is to count the number of subsequences of the given array… Read More

# Category Archives: Recursion

Given an array arr[] of N non-negative integers and an integer K, the idea is to find the length of the longest subsequence having Xor… Read More

Given a Binary Tree and an integer target, denoting the value of a node, the task is to find the sum of distances of all… Read More

Given a binary tree consisting of N nodes, the task is to find the sum of depths of all subtree nodes in a given binary… Read More

Given an array arr[] of size N and a 2D array Q[][] consisting of queries of following two types: 1 X Y: Update the array… Read More

Given a 2D array edges[][] of type { X, Y } representing that there is an edge between the node X and Y in a… Read More

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 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 an integer N and an array maxDigit[], the task is to count all the distinct N-digit numbers such that digit i does not appear… Read More