Skip to content

Category Archives: Recursion

Given the current position of a Knight as (i, j), find the count of different possible positions visited by a knight after N moves (in… Read More
Given a string S consisting of N digits, the task is to print all possible combinations of the digits of the S that is a… Read More
Given an array pre[], representing the Preorder traversal of a Perfect Binary Tree consisting of N nodes, the task is to construct a Perfect Binary… Read More
Given a stack S, the task is to copy the content of the given stack S to another stack T maintaining the same order. Examples:… Read More
Given a positive integer N, the task is to find the number of all N-digit numbers whose adjacent digits have equal Greatest Common Divisor(GCD). Examples:… Read More
Given a string S consisting of N characters and an array M[] of pairs of characters such that any character M[i][0] can be replaced with… Read More
A recursive lambda expression is the process in which a function calls itself directly or indirectly is called recursion and the corresponding function is called… Read More
Given an array arr[] consisting of N positive integers such that arr[i] denotes the size of the ith group sitting in a donut shop and… Read More
Given a string S size of N consisting of characters ‘a‘, ‘b‘, and ‘c‘ only, the task is to check if the given string can… Read More
Given an N-array Tree (Generic Tree) and an integer K, the task is to find the Kth smallest element in an N-array Tree. Examples: Input:… Read More
Given a string S consisting of N characters, the task is to find the minimum number of pairs of characters that are required to be… Read More
Given a Generic Tree consisting of N nodes, the task is to find the average width for each node present in the given tree. The… Read More
Given a positive integer K, and an array arr[] consisting of N( =9) integers such that arr[i] represents the cost of the digit (i+1), the… Read More
Given an array arr[] of size N,  the task is to count the number of non-empty subsets whose product is equal to P1×P2×P3×……..×Pk  where P1,… Read More
Given an integer N, the task is to print all possible Full Binary Trees with N nodes. The value at the nodes does not contribute… Read More