Given a binary tree, return all the paths from the root node to the leaf nodes.
Explanation: A leaf node refers to a node with no child nodes.
Traverse the binary tree in a depth-first manner, concatenating the nodes of the paths into strings. After reaching the root node, push the concatenated string into the target array. If there are no nodes, return an empty array. Define the target array target
. If there are no defined nodes, return empty. If there are no left and right children, i.e., it is a leaf node, push the cached string into the array and return to end the recursion. If a left child exists, recursively traverse to the left and concatenate the left child's node value to the string and pass it. If a right child exists, recursively traverse to the right and concatenate the right child's node value to the string and pass it. Then start the recursion. Note that the problem requires strings instead of numbers, so the node value at the start of the recursion needs to be converted to a string. Finally, return the target array.