Binary Tree Inorder Traversal

Easy

Binary Tree Inorder Traversal

Problem Statement

Given the root node of a binary tree, traverse the tree in inorder. The inorder traversal visits the left subtree, the current node, and then the right subtree.

Rules and Constraints

  • The binary tree nodes must be uniquely identified through their references or values.
  • Each node in the tree has a left child node and a right child node.
  • The left child node refers to the left subtree of the current node, and the right child node refers to the right subtree.
  • All nodes, including null nodes, should be visited according to the inorder traversal strategy.

Note: Inorder traversal order is typically defined as

Left -> Root -> Right
. Your algorithm should visit nodes in this order.

Example

Input: {"root":[1,null,2,3]} Output: [1,3,2]

CompaniesAmazon
JavaScript

Login to write code

Solve problems, verify your skills, and earn XP.