CodeMosa
Master LeetCode Patterns
All Patterns
Collections
Sign In
Back
Tree DFS
Question 1 of 12
8% Complete
Medium
To collect all root-to-leaf paths, which traversal and technique are most natural?
A
Preorder DFS with path list and backtracking
B
Level-order BFS with queue only
C
Inorder traversal using a stack
D
Randomized DFS
Need a hint?
Track path and backtrack