Skip to content

Category Archives: Recursion

Given a string S, the task is to count the maximum occurrence of subsequences in the given string such that the indices of the characters… Read More
Given two positive integers N and K, the task is to count the number of positive integers D such that D has N digits and… Read More
Given an array arr[] of length N and a number K, the task is to find all the subsequences of the array whose sum of… Read More
Given an integer N greater than 0, the task is to find the occurrence of digit K present in the given number N. Examples:  Input:… Read More
Given an array A containing N elements. Partition any subset of this array into two disjoint subsets such that both the subsets have an identical… Read More
Given a string S, the task is to find the length longest sub-string which is a palindromeExamples:  Input: S = “aaaabbaa” Output: 6 Explanation: Sub-string “aabbaa” is the… Read More
Given a binary tree, the task is to print all the palindromic paths of this binary tree. Palindromic path: Path in which the concatenation of… Read More
Given an integer N and set of digits D[], which consists of digits from [1, 9]. The task is to count the numbers possible less… Read More
Given two numbers and N and D. Apply any of two below operations to N:   add D to N change N to digitsum(N), where digitsum(N)… Read More
Given a Binary Tree, the task is to print all prime levels of this tree.  Any level of a Binary tree is said to be… Read More
Given a Vector of Vectors (2D vector), the task is to flatten this 2d vector. Examples: Input: vector = [[1, 2, 3, 4], [5, 6],… Read More
The Expectimax search algorithm is a game theory algorithm used to maximize the expected utility. It is a variation of the Minimax algorithm. While Minimax… Read More
Given Adjacency List representation of graph of N vertices from 1 to N, the task is to count the minimum bipartite groups of the given… Read More
Given two integers N and K, the task is to count the number of ways to divide N into K groups of positive integers such… Read More
Given coordinates of a source point (srcx, srcy) and a destination point (dstx, dsty), the task is to determine the possible path to reach the… Read More