3.2) Minimum Depth of Binary Tree
Given a binary tree, find the minimum depth of the tree. The minimum depth is defined as the minimum distance from the root node to the nearest leaf node. A…
Master C, C++, Data Structures, Algorithms, Design Patterns, and More!
Given a binary tree, find the minimum depth of the tree. The minimum depth is defined as the minimum distance from the root node to the nearest leaf node. A…
Given the root of a binary tree, return the zigzag level order traversal of its nodes' values. Zigzag level order traversal means visiting all nodes at each level alternatively from…
Given the root of a binary tree, return the level order traversal of its nodes' values. Level order traversal means visiting all nodes at each level from left to right…
Given the root of a binary tree, a lonely node is a node that has no siblings (i.e., it's the only child of its parent). Return an array containing the…
Given the root of a binary tree, return the inorder traversal of its nodes' values. In inorder traversal, we visit the left subtree first, then the current node, and finally…
Given the root of a binary search tree (BST), and integers low and high, find the sum of all node values in the BST that are within the range .
Given a binary tree, find the length of the longest path between any two nodes in the tree. This path may or may not pass through the root.
Given a binary tree, where each node has a value between 0 and 9, find the total sum of all root-to-leaf numbers. A root-to-leaf number is a number represented by…
Given a binary tree, find the maximum path sum. The maximum path sum is defined as the maximum sum of any path from any node to any node in the…
Given a binary tree, find its maximum depth. The maximum depth is the number of nodes along the longest path from the root node down to the farthest leaf node.