You are given the root of a binary tree, return the total number of leaf nodes. A leaf node is a node that has no children.
3
Nodes 9, 15, and 7 are leaf nodes as they have no children. The total count is 3.
1
The tree consists of a single node (1), which is also a leaf node. The total count is 1.
None
0
An empty tree has no nodes, therefore no leaf nodes. The total count is 0.
3