Given a binary tree and a value K, the task is to check if every node of the binary tree has either the value of… Read More
Category Archives: Recursion
Given binary string str, the task is to check whether the given string follows the below condition or not: String starts with a ‘1’. Each… Read More
Given an undirected graph defined by the number of vertex V and the edges E[ ], the task is to find Maximal Independent Vertex Set… Read More
Given a string str and two characters X and Y, the task is to write a recursive function to replace all occurrences of character X… Read More
Given a Binary Tree, the task is to find the maximum value of Bitwise AND from any path from the root node to the leaf… Read More
Given a binary tree, the task is to find the absolute difference between the even valued and the odd valued nodes in a binary tree.… Read More
Given a binary tree consisting of N nodes, the task is to print the nodes that are just above the leaf node.Examples: Input: N =… Read More
Given a valid parenthesis string S, the task is to find the weight of the parenthesis based on the following conditions: Weight of “( )”… Read More
Given an integer array arr[] of size N and an integer K. The task is to find the length of the longest subsequence whose sum… Read More
Given a rod of length N meters, and the rod can be cut in only 3 sizes A, B and C. The task is to… Read More
Recursion is a concept where a function calls itself by direct or indirect means. Each call to the recursive function is a smaller version so… Read More
Given a Binary Tree, the task is to print the nodes that have grandchildren. Examples: Input: Output: 20 8 Explanation: 20 and 8 are the grandparents of… Read More
Given a Binary Tree and a positive integer K. The task is to check whether the Balanced BST of size K exists in a given… Read More
Given a string str, the task is to check if it can be split into substrings such that each substring starts with a numeric value… Read More
Given an undirected graph having N vertices and M edges and each vertex is associated with a cost and a source vertex S is given.… Read More