#C522. Find Minimum Value in a Binary Tree
Find Minimum Value in a Binary Tree
Find Minimum Value in a Binary Tree
Given a binary tree, find the minimum value stored in the tree. The tree is provided in level-order format where the token null
represents a missing node. Note that the tree may contain negative integers. Your task is to build the tree from the input and compute the minimum value.
You can formulate the problem as follows: $$\min_{node \in Tree} (node.val)$$ Make sure to use a depth-first search (DFS) approach to solve it efficiently.
inputFormat
The input is a single line containing space-separated tokens representing the nodes of the binary tree in level-order. Each token is either an integer or the string null
(which indicates an absent child).
outputFormat
Output a single integer which is the minimum value found in the binary tree.
## sample10
10