Posts that are related to Recursion.

ABCO Interview Experience | Set 4

1st Round: Consisted of 20 questions out of which 15 were MCQ and 3 were DBMS queries and 2 were programming questions. Out of 260… Read More »

Decode a string recursively encoded as count followed by substring

An encoded string (s) is given, the task is to decode it. The pattern in which the strings are encoded is as follows. <count>[sub_str] ==>… Read More »

Inmobi Interview Experience | Set 5 (Through College Test)

I recently got an opportunity of being interviewed at Inmobi after getting shortlisted for the Inmobi codies test. I was called for onsite interviews at… Read More »

Recaman’s sequence

Given an integer n. Print first n elements of Recaman’s sequence. Examples: Input : n = 6 Output : 0, 1, 3, 6, 2, 7… Read More »

Find ways an Integer can be expressed as sum of n-th power of unique natural numbers

Given two numbers x and n, find number of ways x can be expressed as sum of n-th power of unique natural numbers. Examples :… Read More »

Recursive Insertion Sort

Insertion sort is a simple sorting algorithm that works the way we sort playing cards in our hands. Below is an iterative algorithm for insertion… Read More »

Recursive Bubble Sort

Background : Bubble Sort is the simplest sorting algorithm that works by repeatedly swapping the adjacent elements if they are in wrong order. Example: First… Read More »

Last non-zero digit of a factorial

Given a number n, find the last non-zero digit in n!. Examples: Input : n = 5 Output : 2 5! = 5 * 4… Read More »

Generate all binary strings without consecutive 1’s

Given a integer K. Task is Print All binary string of size K (Given number). Examples: Input : K = 3 Output : 000 ,… Read More »

Program to implement Collatz Conjecture

Given a positive integer n, the task is to find whether this number reaches to 1 after performing following two operations:- If n is even,… 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 »

Highest power of 2 less than or equal to given number

Given a number n, find the highest power of 2 that is smaller than or equal to n. Examples : Input : n = 10… Read More »

Program for Chocolate and Wrapper Puzzle

Given following three values, the task is to find the total number of maximum chocolates you can eat. money : Money you have to buy… Read More »

Word Break Problem using Backtracking

Given a valid sentence without any spaces between the words and a dictionary of valid English words, find all possible ways to break the sentence… Read More »

Print all longest common sub-sequences in lexicographical order

You are given two strings.Now you have to print all longest common sub-sequences in lexicographical order? Examples: Input : str1 = “abcabcaa”, str2 = “acbacba”… Read More »