Skip to content

Category Archives: Recursion

Given an undirected graph with N vertices and N edges that contain only one cycle, and an array arr[] of size N, where arr[i] denotes… Read More
Given an array arr[] consisting of N integers, the task is to find the minimum cost to remove all elements from the array such that… Read More
Given a string str of length N, the task is to print all possible non-empty subsequences of the given string such that the subsequences either… Read More
Given an integer N, the task is to reduce the value of N to 0 by performing the following operations minimum number of times: Flip… Read More
Given a string str of length N, the task is to print all possible distinct subsequences of the string str which consists of non-repeating characters… Read More
Given a sorted array arr[] of size N, the task is to check if it is possible to reach the end of the given array… Read More
Given a Binary Tree, the task is to find the sum of all such nodes from the given tree whose sum of left and right… Read More
Given an N-ary tree rooted at 1, the task is to assign values from the range [0, N – 1] to each node in any… Read More
Given two arrays arr1[] and arr2[] of length M and N consisting of digits [0, 9] representing two numbers and an integer K(K ≤ M… Read More
Given an array arr[] of size N, the task is to count the number of longest increasing subsequences present in the given array. Examples: Input:… Read More
Given a binary array arr[] of size N and two players, A and B. The task is to minimize the score for player A by… Read More
Given an integer N, the task is to count all possible strings of length N consisting of vowels {a, e, i, o, u} that can… Read More
Given three positive integers N, X, and Y, the task is to count N-digit numbers containing of X or Y only as digits and the… Read More