## Divide an array into K subarray with the given condition

Given an array arr[] and an integer K. The task is to divide the array into K parts ( subarray ) such that the sum… Read More »

## Counts Path in an Array

Given an array A consisting of positive integer, of size N. If the element in the array at index i is K then you can… Read More »

## Maximum number of given operations to remove the entire string

Given a string str containing lowercase English characters, we can perform the following two operations on the given string: Remove the entire string. Remove a… Read More »

## Python | Handling recursion limit

When you execute a recursive function in Python on a large input ( > 10^4), you might encounter a “maximum recursion depth exceeded error”. This… 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 »

## 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 »

## Recursive program to insert a star between pair of identical characters

Given a string with repeated characters, we have to insert a star i.e.” * “ between pair of adjacent identical characters using recursion. Examples: Input… Read More »

## Check if item can be measured using a scale and some weights

Given some weights of masses a0, a1, a2, …, a100, a being an integer, and a weighing scale where weights can be put on both… Read More »

## Number of ways to divide a given number as a set of integers in decreasing order

Given two numbers and . The task is to find the number of ways in which a can be represented by a set such that… Read More »

## Tail recursion to calculate sum of array elements.

Given an array A[], we need to find the sum of its elements using Tail Recursion Method. We generally want to achieve tail recursion (a… Read More »

## Recursive Practice Problems with Solutions

Basics – Recursion Recursive Functions Tail Recursion Strings – Given a string, print all possible palindromic partitions Check if a number is Palindrome Print all… Read More »

## Tail Recursion for Fibonacci

Write a tail recursive function for calculating the n-th Fibonacci number. Examples : Input : n = 4 Output : fib(4) = 3 Input :… Read More »

## Recursion

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 »

## Tail Call Elimination

We have discussed (in tail recursion) that a recursive function is tail recursive if recursive call is the last thing executed by the function. filter_none… Read More »

## Tail Recursion

What is tail recursion? A recursive function is tail recursive when recursive call is the last thing executed by the function. For example the following… Read More »