# Category Archives: Recursion

Given a directed binary tree of N nodes whose edges are directed from the parent to the child, the task is to count the number… Read More
Given two integers L and R, the task is to find the count of numbers in the range [L, R] which have only 2 or… Read More
Given an n-ary Tree having N nodes numbered from 1 to N, the task is to print a list of nodes containing 0, 1, 2,… Read More
Given a binary tree, the task is to: Print all the leaf nodes and then delete them all.  Repeat this process till the tree becomes… Read More
Given a Binary Tree where each node has a value of either 0 or 1, the task is to convert the given Binary tree to… Read More
Given an array A[] of size N and a digit K. Find the number of sub-sequences of the array where the last digit of the… Read More
Given a matrix mat[][] of size N * M and an integer K, the task is to find a path from the top-left cell (0,… Read More
Given an array arr[] that contains N integers, the task is to find the largest subset having sum at least 0. Examples: Input: arr[] =… Read More
Given an array arr[] and integer K, the task is to count the number of subsequences of the array such that after adding all the… Read More
Given an array arr[] containing N integers and an integer K, the task is to minimize the subset-sum difference after removing K elements from the… Read More
Given three strings, ‘X‘, ‘Y‘ and ‘Z‘, the task is to count the number of subsequences of ‘X‘ which is lexicographically greater than or equal… Read More
Given two integers N and H, the task is to find the count of distinct Binary Search Trees consisting of N nodes where the maximum… Read More
Given two strings A and B of size N and M respectively, where B is a sub-sequence of A and an array arr[] of size… Read More
Given a matrix of size N * M and Q queries, the task is to find how many different regions will be there, after performing… Read More
Given two integer arrays A[] and B[] of different length N and M respectively, the task is to choose any subsequence of same length from… Read More