Skip to content

Category Archives: Recursion

Given a graph, the task is to detect a cycle in the graph using degrees of the nodes in the graph and print all the… Read More
Given a number N. The task is to find the number of integers from 1 to n which contains digits 0’s and 1’s only. Examples:  … Read More
Given a N x N matrix mat[][] consisting of non-negative integers, the task is to find the number of ways to reach a given score… Read More
Given two integers n and m and a and b, in a single operation n can be multiplied by either a or b. The task… Read More
This article is aimed at giving a recursive implementation for pattern printing. Simple triangle pattern: C++ // C++ code to demonstrate star pattern #include <iostream>… Read More
Given a tree having every node’s value as either 0 or 1, the task is to find whether the given binary tree contains any sub-tree… Read More
Given two integers A and B, the task is to calculate 22A % B. Examples:   Input: A = 3, B = 5 Output: 1 223 % 5… Read More
Given three integers X, N and M. The task is to find XXX…(N times) % M where X can be any digit from the range… Read More
Given two integers N and K, the task is to count the number of ways to make a binary string of length N such that… Read More
Given a positive integer number N. The task is to generate all the binary strings of N bits. These binary strings should be in ascending… Read More
Given an array arr[] and an integer K, the task is to find out the minimum product of a subsequence where adjacent elements of the… Read More
Given an integer n, the task is to find the sum of the series 11 + 22 + 33 + ….. + nn using recursion.… Read More
Given a value n, the task is to find sum of the series (1*2) + (2*3) + (3*4) + ……+ n termsExamples:   Input: n =… Read More
Given an array ‘arr’ containing the weight of ‘N’ distinct items, and two knapsacks that can withstand ‘W1’ and ‘W2’ weights, the task is to… Read More