Given an array arr[] consisting of N positive integers, the task is to find the minimum cost required to either cross the array or reach… Read More
Category Archives: Recursion
Given a positive integer N, the task is to find the number of binary strings of length N which contains “11” as a substring. Examples:… Read More
Given a binary tree consisting of N nodes, the task is to check if the nodes in the top view of a Binary Tree forms… Read More
Given a positive integer N, the task is to construct the lexicographically largest array of size (2 * N – 1) comprising of first N… Read More
Given an array nums[] of size N, the task is to print all possible distinct permutations of the array nums[] (including duplicates). Input: nums[] =… Read More
Given an integer N and a 2D array cost[][3], where cost[i][0], cost[i][1], and cost[i][2] is the cost of painting ith house with colors red, blue,… Read More
Given a positive number N, the task is to find the sum of the first (N + 1) Fibonacci Numbers. Examples: Input: N = 3Output:… Read More
Given an array input[] consisting only of 1s initially and an array target[] of size N, the task is to check if the array input[]… Read More
Given an undirected graph G with vertices numbered in the range [1, N] and an array Edges[][] consisting of M edges, the task is to… Read More
Given an integer N, denoting the number of computers connected by cables forming a network and a 2D array connections[][], with each row (i, j)… Read More
Given a Binary Tree, the task is to remove all the subtrees that do not contain any odd valued node. Print the Levelorder Traversal of… Read More
Given a binary tree consisting of either 1 or 0 as its node values, the task is to find the sum of all vertical levels… Read More
Given an array arr[] consisting of N integers and an integer K, the task is to find the minimum sum of incompatibilities of K subsets… Read More
Given a Generic Tree consisting of N nodes (rooted at 0) where each node is associated with a value, the task for each level of… Read More
Given an array arr[] and an integer K, the 0th index, the task is to collect the maximum score possible by performing the following operations: … Read More