Leetcode 144. Binary Tree Preorder Traversal
You are given the `root` of a binary tree, return the **preorder traversal** of its nodes' values.
Examples
Example 1
Input: root = []
Output: []
Constraints
- `0 <= number of nodes in the tree <= 100`
- `-100 <= Node.val <= 100`
How the tests work: trees are written as level-order arrays —
[1,null,2]is a root1with a right child2. Your function receives realTreeNodeobjects.