dsa · easy
Binary Tree Inorder Traversal
GreyOrangeTreeRecursionStackFoundation
Return inorder values (left, node, right). Tree: [val, left, right] or None.
Arguments
root— the binary tree; each node is[val, left, right]orNone
**Example:** [1,None,[2,[3,None,None],None]] → [1,3,2].
Constraints
Number of nodes in [0, 100] Hidden tests include near-max size for this bound; a slower-than-intended solution TLEs.
Examples
Example 1
Input: [1,None,[2,[3,None,None],None]] Expected: [1,3,2]
Example 2
Input: None Expected: []