Given a binary tree, find its minimum depth. The minimum depth is defined as the number of nodes along the shortest path from the root node down to the nearest leaf node. A leaf node is a node that does not have any children.
Given the root of a binary tree and an integer targetSum, return all paths from the root to the leaf nodes where the sum of the node values along the path equals the targetSum. A root-to-leaf path is defined as any path that starts from the root and ends at a leaf node. A leaf node is a node that does not have any children.
Given the root of a binary tree, flatten the tree into a ’linked list’ where each node’s right pointer points to the next node in pre-order traversal, and the left pointer of all nodes is null. The ’linked list’ should maintain the same order as a pre-order traversal of the binary tree.
You are given a perfect binary tree where every parent node has two children and all leaves are at the same level. Your task is to populate the ’next’ pointer of each node to point to its next right node. If no such node exists, set the ’next’ pointer to NULL. Initially, all ’next’ pointers are set to NULL.
You are given the root of a binary tree. The task is to return the preorder traversal of the tree. Preorder traversal means visiting the root node first, followed by the left subtree, and then the right subtree.
You are given the root of a binary tree. Imagine yourself standing on the right side of the tree, and return the values of the nodes you can see when viewed from the right, ordered from top to bottom.