Given an undirected weighted graph G consisting of N vertices and M edges, and two arrays Edges[][2] and Weight[] consisting of M edges of the… Read More

# Category Archives: Recursion

Given a Binary Tree consisting of N nodes, the task is to find the number of paths from the root to any node X, such… Read More

Given a positive integer N representing the number of disks in the Tower of Hanoi, the task is to solve the Tower of Hanoi puzzle… Read More

Given an array arr[] consisting of N binary strings, and two integers A and B, the task is to find the length of the longest… Read More

The tree is a hierarchical Data Structure. A binary tree is a tree that has at most two children. The node which is on the… Read More

Given a matrix grid[][] of dimensions M * N, three integers X, Y, and K, the task is to check if there exists any path… Read More

Given a binary tree consisting of N nodes, the task is to replace each node in the binary tree with the sum of its preorder… Read More

Given an array arr[] consisting of N positive integers and a positive integer X, the task is to check if the sum of the given… Read More

Given a binary string S and an array A[], both of size N, the task is to find the maximum score possible by removing substrings… Read More

Given two strings text and pattern of length M and N respectively, the task is to check if the pattern matches the text or not.… Read More

Given two positive integers N and S, the task is to count the number of unique outcomes possible when S flip operations are performed on… Read More

Given a binary matrix mat[][] that represents the adjacency matrix representation of a graph, where mat[i][j] as 1 represents that there is an edge between… Read More

Given a 2D array Edges[][], representing a directed edge between the pair of nodes in a Directed Acyclic Connected Graph consisting of N nodes valued… Read More

Given two integers N and K, the task is to find all valid combinations of K numbers that adds up to N based on the… Read More