Give an integer N, the task is to find the minimum number of moves to reduce N to 0 by one of the following operations:… Read More

# Tag Archives: Algorithms-Recursion

Given an integer N, the task is to print all the possible ways in which N can be written as the sum of two or… Read More

Given a number in form of string str and an integer K, the task is to find the smallest integer that can be formed after… Read More

Given a Binary Tree, the task is to print the nodes that have grandchildren. Examples: Input: Output: 20 8 Explanation: 20 and 8 are the grandparents of… Read More

Given an array arr[] of N positive integers and two positive integers S and K, the task is to reach the position of the array… Read More

Given two strings S and T and a number K, the task is to count the number of ways to convert string S to string… Read More

Given N blocks out of which K are colored. These K colored blocks are denoted by an array arr[]. The task is to count the… Read More

Given a number N, the task is to print all the factors of N using recursion. Examples: Input: N = 16 Output: 1 2 4… Read More

Given a binary tree where node values are lowercase alphabets, the task is to find the lexicographically smallest diameter. Diameter is the longest path between… Read More

Given a binary tree, the task is to find the bottom view of a binary tree using recursion. Examples: Input: 1 \ 2 \ 4… Read More

Given five integers i, Fi, j, Fj and N. Where Fi and Fj are the ith and jth term of a sequence which follows the… Read More

What is Recursion? The process in which a function calls itself directly or indirectly is called recursion and the corresponding function is called as recursive… Read More

Given an integer N > 0, the task is to find the maximum product of digits among numbers less than or equal to N. Examples:… Read More

Recursion is a mechanism when a function calls itself again and again till the required condition is met. When the function call statement is written… Read More

A linked list L0 -> L1 -> L2 -> ….. -> LN can be folded as L0 -> LN -> L1 -> LN – 1… Read More