Diwali Offer!Flat 20% OFF
Enroll Now
PrakalpanaLive online tech training

109. Binary Tree Inorder Traversal

EasyDay 33 of 60Trees & BST

Given the root of a binary tree, return the values of its nodes in inorder: first the left subtree, then the node itself, then the right subtree.

Example 1
Input: root = [1,null,2,3]
Output: [1,3,2]
Node 1 has no left child, so it comes first; then the subtree of 2 gives 3 before 2.
Example 2
Input: root = []
Output: []
Constraints
  • The number of nodes is in the range 0 to 100
  • -100 <= Node.val <= 100
Hints
Frequently asked at: Amazon, Microsoft, TCS, Infosys, Wipro
Ctrl + Enter runs the examples

Not sure what to learn next?

A 1-on-1 session with an industry mentor and a roadmap built for you. How it works

  1. 1Discuss your goals
  2. 2Get a personal plan
  3. 3Start learning
Book for β‚Ή200/ 30 min