← Back to companies
[ OK ] Loaded —
[ INFO ]
$ cd
$ ls -lt
01
02
03
04
05
$ ls -lt
01
02
03
04
05
user@intervues:~/$
Given a binary tree, implement three traversal methods:
Return the order of visited nodes for each traversal.
Constraints:
Example 1:
`
Input: root = [1,2,3,4,5,6,7]
1
/
2 3
/ \ /
4 5 6 7
Output:
Example 2:
Input: root = [1] Output: [1] for all methods
Example 3:
Input: root = [] Output: [] for all methods
Source: Apple Phone Screen