Easy
Quiz
#257 Binary Tree Paths
APPROACH
Given the root of a binary tree, collect every path from root to leaf and return them. A leaf is any node that has no children. The paths may be returned in any order.
Example 1:
Input: root = [1,2,3,null,5]
Output: ["1->2->5","1->3"]
Example 2:
Input: root = [1]
Output: ["1"]
1 of 4
1:00
What is the optimal approach for this problem?