0144. Preorder Traversal
Easy | Binary Tree + Traversal | 4 ms (99.93%), 13.3 MB (95.41%)
Source: LeetCode - Binary Tree Preorder Traversal GitHub: Solution / Performance
Given the root
of a binary tree, return the preorder traversal of its nodes' values.
Pop the stack to retrieve the current node and append the current node's value
Push left-child and then right-child node onto the stack if existing
Last updated