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
def MeetingNode(self, pHead): if not pHead: return None pSlow = pHead.next #定义一个慢指针2 pFast = pSlow.next#定义一个快指针3 while pSlow != pFast : #判断快慢指针是否相等 pSlow = pSlow.next pFast=pFast.next.next if pFast==None: break return pSlow,pFast
当链表中没有环时,pFast.next.next最后会变成None,但是代码中没有判断pFast.next.next是否为空的条件,因此我在代码中加入了判断条件 if pFast==None: break
The text was updated successfully, but these errors were encountered:
No branches or pull requests
当链表中没有环时,pFast.next.next最后会变成None,但是代码中没有判断pFast.next.next是否为空的条件,因此我在代码中加入了判断条件
if pFast==None:
break
The text was updated successfully, but these errors were encountered: