Data Structures19 sections · 729 units
Open in Course

Problem - Binary Tree Inorder

Classic traversal problem

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

Example: For tree with root 1, right child 2, and 2's left child 3, the inorder traversal is [1,3,2][1, 3, 2]. This problem seems trivial with recursion.

The real challenge is doing it iteratively, which interviewers often ask as a follow-up. Constraints: up to 100100 nodes, values from 100-100 to 100100.