Check if binary tree is a sum tree
In this tutorial we shall check if the tree is a sum tree or not. Problem Statement: You are given the root node of a binary tree. You need to check if that tree is a sum tree or not. Example: Consider...
View ArticleAdd all the node values in a Binary Tree or Sum of a Binary tree
In this chapter, we shall see how to add all the nodes value. Problem Statement: Given a binary tree root node, return the sum of all the nodes of the tree. Example: Consider the tree below: The total...
View ArticlePrint the number of leaf nodes in a binary tree
In this chapter we shall print the number of leaf nodes in a binary tree. Problem Statement: You are given the root node of the tree. You need to return the total number of leaf nodes present in that...
View ArticlePrint all the paths from root node to leaf node
In this chapter we shall see how to print all the paths from root to leaf nodes. Problem Statement: You are given the root node of a binary tree, you need to print all the paths from root node to leaf...
View ArticlePrint the nodes at k distance from the root of a binary tree
In this tutorial we shall see how to print all the nodes that is k distance from root. Problem statement: Given the root node and the distance k, print all the nodes that are at distance k from root...
View ArticleDynamic Programming: Longest Increasing Subsequence
In this tutorial we shall look at longest increasing subsequence and we shall solve it by using Dynamic Programming. Problem Statement: You are given an array of integers; you need to find the longest...
View ArticleLongest Bitonic Subsequence
In this tutorial we shall solve longest Bitonic subsequence using DP. Before solving the question, let’s understand what does Bitonic means. Bitonic is a sequence where the number increases at certain...
View ArticleGet Max Coin In Game problem.
In this chapter we shall solve how to get maximum coin in a game problem with help of DP. Problem Statement: You and your friend are playing a game to pick numbers from an array of even length. You...
View ArticleRod Cutting Problem
In this tutorial we shall learn about rod cutting problem. Problem statement: You are given a rod of length n and you need to cut the cod in such a way that you need to sell It for maximum profit. You...
View Article