less than 1 minute read

Given a binary tree root, return an inorder traversal of root as a list.

Bonus: Can you do this iteratively?

Constraints

  • n ≤ 100,000 where n is the number of nodes in root

https://binarysearch.com/problems/Inorder-Traversal

Examples

Example 1

Input

  • root =

Output

  • answer = [1, 80, 159]

Solution

Leave a comment