Explanation:The inorder traversal is: Left (null for node 1), Node (1), Right (node 2). Then for node 2: Left (3), Node (2), Right (null). Combined and flattened: [1, 3, 2]
Example 2:
Input:root = [1,2,3,4,5,null,8,null,null,6,7,9]
Output:[4,2,6,5,7,1,3,9,8]
Explanation:The inorder traversal is done recursively starting from the root. The order will be left subtree, current node, then right subtree
Example 3:
Input:root = []
Output:[]
Explanation:An empty tree returns an empty list.
Example 4:
Input:root = [1]
Output:[1]
Explanation:A tree with a single node returns a list containing that node's value.