Given the root of a tree, you are asked to find the most frequent subtree sum. The subtree sum of a node is defined as the sum of all the node values formed by the subtree rooted at that node (including the node itself). So what is the most frequent subtree sum value? If there is a tie, return all the values with the highest frequency in any order.
Given a binary tree, write a function to get the maximum width of the given tree. The maximum width of a tree is the maximum width among all levels.
Given the root node of a binary search tree, return the sum of values of all nodes with a value between L and R (inclusive). The binary search tree is guaranteed to have unique values.
Given a binary tree where node values are digits from 1 to 9. A path in the binary tree is said to be pseudo-palindromic if at least one permutation of the node values in the path is a palindrome.
Given a binary tree, find its minimum depth. The minimum depth is the number of nodes along the shortest path from the root node down to the nearest leaf node.
Given preorder and inorder traversal of a tree, construct the binary tree.
Construct Binary Tree from Inorder and Postorder Traversal. Given inorder and postorder traversal of a tree, construct the binary tree.
Inverting a Binary Tree is a problem asked in a lot of interviews and we will be tackling it in a simple but efficient manner. Any tree-related problem should be attempted to be solved in a recursive approach since Tree is a localized data structure i.e small trees make up large trees.
Given a Complete Binary Tree, count the number of nodes. Definition of a Complete Binary Tree: In a Complete Binary Tree every level, except possibly the last, is completely filled, and all […]
Given a binary tree, return all root-to-leaf paths.A leaf is a node with no children.