Source: LeetCode Solution: We do a preorder traversal add each node in the string followed by an arrow "->" if the current node is a leaf node (have no right or left child) then we add the string to the list, otherwise, we add an arrow and make a recursive call in a preorder fashion. The previous string is stored in stack and we can use it later when the call is returned to add another possible routes from root to the leaf nodes. Complexity Analysis Time complexity : O ( n ) . n nodes need to be traversed ( n represents the number of nodes in a given tree) . Solution: public List< String > binaryTreePaths( TreeNode root) { ArrayList< String > path = new ArrayList (); binaryPath(root, "" ,path); return path; } public static void binaryPath( TreeNode root, String s, List< String > path){ if (root == null ) return ; ...