Posts that are related to Recursion.

## Count of numbers between range having only non-zero digits whose sum of digits is N and number is divisible by M

Given a range [L, R] and two positive integers N and M. The task is to count the numbers in the range containing only non-zero… Read More »

## Print Stack Elements from Bottom to Top

Given a stack s, the task is to print the elements of the stack from bottom to top, such that the elements are still present… Read More »

## Check whether two strings are equivalent or not according to given condition

Given two strings A and B of equal size. Two strings are equivalent either of the following conditions hold true: 1) They both are equal.… Read More »

## Delete nodes which have a greater value on right side using recursion

Given a singly linked list, remove all the nodes which have a greater value on the right side. Examples: a) The list 12->15->10->11->5->6->2->3->NULL should be… Read More »

## Program for power of a complex number in O(log n)

Given a complex number of the form x + yi and an integer n, the task is to calculate the value of this complex number… Read More »

## Find the value of ln(N!) using Recursion

Given a number N, the task is to find the log value of the factorial of N i.e. log(N!). Note: ln means log with base… Read More »

## Java Program to print distinct permutations of a string

Given a string str, the task is to print all the distinct permutations of str. A permutation is an arrangement of all or part of… Read More »

## Split the array into equal sum parts according to given conditions

Given an integer array arr[], the task is to check if the input array can be split in two sub-arrays such that: Sum of both… Read More »

## Sum of nodes at maximum depth of a Binary Tree | Set 2

Given a root node to a tree, find the sum of all the leaf nodes which are at maximum depth from root node. Example: 1… Read More »

## Print the last k nodes of the linked list in reverse order

Given a linked list containing N nodes and a positive integer k should be less than or equal to N. The task is to print… Read More »

## Print all permutations of a string in Java

Given a string str, the task is to print all the permutations of str. A permutation is an arrangement of all or part of a… Read More »

## Recursive program to print all numbers less than N which consist of digits 1 or 3 only

Given an integer N, the task is to print all the numbers ≤ N which have their digits as only 1 or 3. Examples: Input:… Read More »

## Modify contents of Linked List – Recursive approach

Given a singly linked list containing n nodes. Modify the value of first half nodes such that 1st node’s new value is equal to the… Read More »

## Count all sub-sequences having product <= K – Recursive approach

Given an integer K and a non negative array arr[], the task is to find the number of sub-sequences having product ≤ K. This problem… Read More »

## Check if a word exists in a grid or not

Given a 2D grid of characters and a word, the task is to check if that word exists in the grid or not. A word… Read More »