Created
July 2, 2022 21:02
-
-
Save RakhmedovRS/bbe2bc542f73aea6d7ec035fa5313de3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private boolean traverse(TreeNode root, ListNode head) | |
{ | |
if (root == null) | |
{ | |
return head == null; | |
} | |
if (root.val == head.val && findPath(root, head)) | |
{ | |
return true; | |
} | |
return traverse(root.left, head) || traverse(root.right, head); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment