As reported: Synopsys R&D Engineer Sr, round 3 (2024): inorder traversal of a binary tree.
Given the root of a binary tree, return the inorder traversal of its node values: the left subtree, then the node, then the right subtree.
This is LeetCode 94 — Binary Tree Inorder Traversal.
Example 1
root = [1,null,2,3] -> [1,3,2]
Example 2
root = [] -> []
Example 3
root = [1] -> [1]
Constraints: 0 ≤ number of nodes ≤ 100; -100 ≤ Node.val ≤ 100.
Code runner format: one line: the tree in level order as a JSON array with null for missing children. Implement inorderTraversal(root); the harness prints the returned list.