# Category Archives: Recursion

Given three positive integers A, B, and K, the task is to find the Kth lexicographically smallest binary string that contains exactly A number of… Read More
Given a tree consisting of N nodes an array edges[] of size N – 1 such that for each {X, Y, W} in edges[] there… Read More
Given a Binary Tree consisting of N nodes having no values in it and an integer X, that represents the value of the root node,… Read More
Given the root of a Complete Binary Tree consisting of N nodes, the task is to find the total number of nodes in the given… Read More
A person wants to transfer bananas over to a destination A km away. He initially has B bananas and a camel. The camel cannot carry… Read More
Given two integers L and R, the task is to find the count of integers in the range [L, R] such that the frequency of… Read More
Given a Generic Tree consisting of N nodes, the task is to find the ZigZag Level Order Traversal of the given tree. Examples: Input: Output:13… Read More
Given two arrays pre[] and in[] representing the preorder and inorder traversal of the binary tree, the task is to check if the given traversals… Read More
Given a generic tree consisting of N nodes, the task is to find the maximum sum of the path from the root to the leaf… Read More
Given weights and values of N items and the capacity W of the knapsack. Also given that the weight of at most K items can… Read More
Go to CDN’s CopyGiven three integers N, M and P, the task is to find the total number of valid arrays that can be created… Read More
Given two integers N and K,  the task is to find the Kth lexicographical ordered string of length N, which has distinct products of each… Read More
Given an array A[] of size N, the task is to find the maximum score possible of this array. The score of an array is… Read More
Given an array arr[] of N integers, an integer K, and Q queries of the type as explained below: (1, L, R): If the query… Read More
Given a string S consisting of N characters, the task is to modify the string S by performing the minimum number of following operations such… Read More