Easy
,Tree
,DFS
,Stack
,Binary Tree
144. Binary Tree Preorder Traversal
Given the root
of a binary tree, return the preorder traversal of its nodes' values.
Example 1:
Example 2:
Example 3:
Constraints:
[0, 100]
.Node.val
<= 100Follow up: Recursive solution is trivial, could you do it iteratively?
recursive
iterative
Marsgoat Jan 9, 2023
Ron Chen Jan 9, 2023