We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
原题链接
const getIntersectionNode = function(headA, headB) { if (headA === null || headB === null) { return null } let pA = headA, pB = headB while (pA !== pB) { pA = pA === null ? headB : pA.next pB = pB === null ? headA : pB.next } return pA }
The text was updated successfully, but these errors were encountered:
if (headA === null || headB === null) { return null }
这一句应该不用判断的,如果其中一个是null,他们走一遍之后必定是null相等
Sorry, something went wrong.
if (headA === null || headB === null) { return null } 这一句应该不用判断的,如果其中一个是null,他们走一遍之后必定是null相等
需要的,如果其中一个是 null,那么一定不相交,就没有必要“走一遍”咯。
No branches or pull requests
原题链接
双指针
The text was updated successfully, but these errors were encountered: