Skip to content

Category Archives: Recursion

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
Given a 2-D array A[][] of size N×3, where each element of the array consists of {x, y, r}, where x and y are coordinates… Read More
Given a Binary Search Tree, The task is to print the elements in inorder, preorder, and postorder traversal of the Binary Search Tree.  Input:  A… Read More
Given an array arr[] of size N and a given difference diff, the task is to count the number of partitions that we can perform… Read More
Given a positive integer N, the task is to find the number of distinct ways to express N as a sum of positive palindromic integers… Read More
Given an array A[] of positive integers, print all the unique non-empty subsets of the array  Note: The set can not contain duplicate elements, so… Read More

Start Your Coding Journey Now!