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 an m x n matrix board containing letters ‘X’ and ‘O’. Capture all regions that are surrounded by ‘X’. A region is captured if it is surrounded by ‘X’ cells and cannot reach the edges of the board.
You are given a reference to a node in a connected, undirected graph. Each node in the graph contains a value (integer) and a list of its neighbors. Your task is to return a deep copy of the entire graph starting from the given node.