Given the root of a binary tree, find the height of the tree.
The height is the number of nodes on the longest path from the root down to any leaf.
Input: root = [5,8,12,null,null,6,10]
Output: 3
Explanation:
The longest path is 5 → 12 → 10, so the height is 3.
Input: root = [4,null,7]
Output: 2
Explanation:
The longest path is 4 → 7, so the height is 2.
Accepted:
Submission: