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

# Category Archives: Recursion

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

Given a matrix grid[][] with dimension M × N of integers, the task is to print the matrix elements using DFS traversal. Examples: Input: mat[][]… Read More

Given an array arr[] consisting of N integers, the task is to minimize the count of elements required to be multiplied by -1 such that… Read More

Given an integer N denoting the number of boxes in a pen, and two players P1 and P2 playing a game of distributing N pens… Read More

Given an array arr[] consisting of N integers and an integer K, the task is to count the number of subsequences of the given array… Read More

Given an array arr[] of N non-negative integers and an integer K, the idea is to find the length of the longest subsequence having Xor… Read More

Given a Binary Tree and an integer target, denoting the value of a node, the task is to find the sum of distances of all… Read More

Given a binary tree consisting of N nodes, the task is to find the sum of depths of all subtree nodes in a given binary… Read More

Given an array arr[] of size N and a 2D array Q[][] consisting of queries of following two types: 1 X Y: Update the array… Read More

Given a 2D array edges[][] of type { X, Y } representing that there is an edge between the node X and Y in a… Read More