The term Recursion can be defined as the process of defining something in terms of itself. In simple words, it is a process in which… Read More

# Tag Archives: tail-recursion

Given a natural number N, the task is to find the sum of the series up to Nth term where the ith term denotes the… Read More

Check if a given number N is a perfect square or not. If yes then return the number of which it is a perfect square,… Read More

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

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

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

Given two numbers K and N, the task is to find the number of ways such that an item at position i returns back to… Read More

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. Or, 2)… Read More

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

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

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

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

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

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