Skip to content

Category Archives: Recursion

What is Recursion? In simple words, recursion is when a function is calling itself directly or indirectly.  It is used to break down the problem… Read More
Given an array item[] representing type, weight, and profit of N items, the task is to maximize the profit by picking different types of elements… Read More
What is tail recursion? Tail recursion is defined as a recursive function in which the recursive call is the last statement that is executed by… 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 a recursive… Read More
Given an array arr[] of size N, the task is to find the maximum number of subsets the array can be split such that the… Read More
Given two integers N and K (K<N), the task is to find the smallest number greater than K by removing digits from N. Note: You… Read More
Write a program to reverse a stack using recursion, without using any loop. Example:  Input: elements present in stack from top to bottom 1 2… Read More
Given an integer matrix mat[][] of size M x N and an integer K, the task is to return the number of paths from top-left… Read More
Given two numbers N and K, and a pair A and B, the task is to multiply N by A or B as many times… Read More
Given a tree with N nodes, an array A[] of size N denoting the value of each node and array edges [][] of size (N-1),… Read More
Given 2 arrays num[] and cost[] containing the number of elements and the cost to buy that many elements respectively. {i.e. cost[i] is the cost… Read More
Given a binary tree and an integer K, the task is to write a program to count the number of nodes such that the path… Read More
Given a binary tree and a node start that is initially infected. For every second, neighbours of an infected node get infected. The task is… Read More
Given N nodes, where each of them is numbered from 0 to N – 1, and array edges, where there is a directed edge from… Read More
These are the special type of recursive functions, where the last statement executed inside the function is the call to the function itself. Advantages of… Read More

Start Your Coding Journey Now!