To solve this problem, you'll have to open it on the computer

Binary Tree Inorder Traversal

Tree
easy
Score: 20

Given the root of a binary tree, return the inorder traversal of its nodes’ values.

Class TreeNode:
    val (int)
    left (TreeNode)
    right (TreeNode)

Input Format

First Parameter - TreeNode root

Output Format

Return the array of values of nodes in inorder sequence.

Example 1:

Input:
    1 2 3 7 4 null 8
Output : 
    7 2 4 1 3 8

Example 2:

Input:
    1 null 2 null 5 3 8 null 4
Output : 
    1 2 3 4 5 8

Constraints

  • The number of nodes in the tree is in the range [0, 100].
  • -100 <= Node.val <= 100
  • Expected Time Complexity: O(n)
  • Expected Space Complexity: O(1)
Submit code to see the your result here