Given the root of a binary tree, implement a function that returns its height. The height of a tree is the number of nodes on the longest path from the root down to a leaf. If the tree is empty, return 0.
Example 1:
Input: root = [1, 2, 3, 4, 5]
Output: 3
Explanation: The longest root-to-leaf path is 1 -> 2 -> 4 (or 1 -> 2 -> 5), which contains 3 nodes.
Example 2:
Input: root = []
Output: 0
Explanation: An empty tree has height 0.
0 <= number of nodes <= 10^4-10^9 <= Node.val <= 10^9