# 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[][3] 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