You are given the root of a binary tree. Your task is to return all root-to-leaf paths. Each path should contain the node values from the root to a leaf.
A root-to-leaf path is a path that:
Return a list containing all such paths.
Input: root = [1,2,3,null,5]
Output: [[1,2,5],[1,3]]
Explanation: The tree has two root-to-leaf paths.
Input: root = [1]
Output: [[1]]
Explanation: The root itself forms the only root-to-leaf path.
Input: root = []
Output: []
Explanation: The tree contains no root-to-leaf paths.
Sign in to write, run, and submit your solution against the full test suite.