## Reduce a number to 1 by performing given operations

Given a number N. The task is to reduce the given number N to 1 in the minimum number of steps. You can perform any… Read More »

- Backtracking | Introduction
- Recursively Reversing a linked list (A simple implementation)
- Modular exponentiation (Recursive)
- Check if a word exists in a grid or not
- How will you print numbers from 1 to 100 without using loop? | Set-2
- Count ways to reach a score using 1 and 2 with no consecutive 2s
- Program to check if an array is palindrome or not using Recursion
- Reduce a number to 1 by performing given operations
- Water Jug Problem using Memoization
- Generating subarrays using recursion
- Recursive program to print all subsets with given sum
- Count all possible position that can be reached by Modified Knight
- Printing all subsets of {1,2,3,...n} without using array or loop
- Find Nth term (A matrix exponentiation example)
- Number of Binary Strings of length N with K adjacent Set Bits
- Print all the combinations of a string in lexicographical order
- Count of Numbers in a Range divisible by m and having digit d in even positions
- Count all Grandparent-Parent-Child Triplets in a binary tree whose sum is greater than X
- Generating all possible Subsequences using Recursion
- Longest Ordered Subsequence of Vowels
- Number of handshakes such that a person shakes hands only once
- Count Unary Numbers in a Range
- Check whether the two Binary Search Trees are Identical or Not
- Maximum length of segments of 0's and 1's
- Check if item can be measured using a scale and some weights
- Number of balanced bracket expressions that can be formed from a string
- Java 8 | Arrays parallelSort() method with Examples
- Product of 2 numbers using recursion | Set 2
- Print all subsequences of a string using ArrayList
- Number of Paths of Weight W in a K-ary tree

Given a number N. The task is to reduce the given number N to 1 in the minimum number of steps. You can perform any… Read More »

Java 8 introduced a new method called as parallelSort() in java.util.Arrays Class. It uses Parallel Sorting of array elements Algorithm of parallelSort() 1. The array… Read More »

There are N number of persons in a party, find the total number of handshake such that a person can handshake only once. Examples: Input… Read More »

Given a string str, print of all the combinations of a string in lexicographical order. Examples: Input: str = “ABC” Output: A AB ABC AC… Read More »

Flood Fill Algorithm is to replace a certain closed or a similarly coloured field with a specified color. The use of the FloodFill algorithm can… Read More »

Prerequisites : Recursion Complexity Analysis Backtracking is an algorithmic-technique for solving problems recursively by trying to build a solution incrementally, one piece at a time,… Read More »

If we take a look at this problem carefully, we can see that the idea of “loop” is to track some counter value e.g. “i=0”… Read More »

Given a function gcd(a, b) to find GCD (Greatest Common Divisor) of two number. It is also known that GCD of three elements can be… Read More »

Given a number num as a string and a number N. The task is to write a program which converts the given number num to… Read More »

Given a binary tree, print the level order traversal in such a way that first two levels are printed from left to right, next two… Read More »

What is Calkin Wilf Sequence? A Calkin-Wilf tree (or sequence) is a special binary tree which is obtained by starting with the fraction 1/1 and… Read More »

Most of the Dynamic Programming problems are solved in two ways: Tabulation: Bottom Up Memoization: Top Down One of the easier approaches to solve most… Read More »

Given a binary tree, flatten it into linked list in-place. Usage of auxiliary data structure is not allowed. After flattening, left of each node should… Read More »

Given an array of N elements and an integer K, print all the distinct integers which can be formed by choosing K numbers from the… Read More »

Given two strings str1 and str2, the task is to count the number of times “str2” occurs in “str1” using recursion. Examples: Input : str1… Read More »