(ListNode head, TreeNode root)
| 6 | return dfs( head.next, node.left) || dfs( head.next, node.right); |
| 7 | } |
| 8 | public boolean isSubPath(ListNode head, TreeNode root) { |
| 9 | if(root == null) return false; |
| 10 | if(root.val == head.val){ |
| 11 | if(dfs(head,root)){ |
| 12 | return true; |
| 13 | } |
| 14 | } |
| 15 | return isSubPath( head, root.left) || isSubPath( head, root.right); |
| 16 | } |
| 17 | } |