Linked List in Binary Tree LeetCode solution in JavaScript
1var isSubPath = function (head, root) {2if (!root) return false;3if (issame(head, root)) return true;4return isSubPath(head, root.left) || isSubPath(head, root.right);5};67function issame(head, root) {8if (!head) return true;9if (!root) return false;10if (head.val != root.val) return false;11return issame(head.next, root.left) || issame(head.next, root.right);12}