Skip to content

Category Archives: Recursion

Given a binary tree, the task is to find the length of the longest path which forms an Arithmetic progression. The path can start and… Read More
Given a Binary Tree rooted at root, the task is to find the sum of all leaf nodes which are left child of their parents… Read More
Given two integers N and K, the task is to print the first K bits of the Nth term of the Thue-Morse sequence. The Thue-Morse… Read More
Given three integers N, X and Y, the task is to check if N can be obtained from 0 using the following operations:  The current… Read More
Given an integer N and an integer D, the task is to reach N from 1 in minimum moves by either adding 1 or doubling… Read More
Given three integers M, N and K, the task is to count all the possible paths from the cell (0, 0, 0) to cell (M-1,… Read More
Given an array arr[] of N integers, the task is to find the minimum difference from 0 after adding or subtracting any element of the… Read More
Given a graph G(V, E), divide it into two sets such that no two vertices in a set are connected directly. If not possible print… Read More
Given a binary string S consisting of 0’s and 1’s, The task is to find the minimum number of flips required to generate a binary… Read More
Given N (N > 1) number of balls and a weight balancing machine. There are N-1 balls of the same weight and one ball heavier… Read More
Given a doubly-linked list containing n nodes. The problem is to reverse every group of k nodes in the list. Examples:  Input: List: 10<->8<->4<->2, K=2Output:… Read More
Given an integer N, the task is to print the ways to get the sum N by repeatedly throwing a dice. Input: N = 3Output: 1… Read More
Given 2 integers M and N, the task is to find the count of all the possible paths from top left to the bottom right… Read More
Given an integer N and a chess knight placed in mobile keypad. The task is to count the total distinct N digit numbers which can… Read More
Given string str, the task is to repeat every substring of the string X number of times where X is the number composed of the… Read More

Start Your Coding Journey Now!