Skip to content
New issue

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

06_linkedlist-SinglyLinked 可重复删除指定 value 的代码有问题 #67

Open
huangdashun opened this issue Oct 15, 2018 · 0 comments

Comments

@huangdashun
Copy link

会报空指针,我改成这样子,应该还会有更好的方法 while (head != null && head.data == value) { head = head.next; } Node pNode = head; while (pNode != null && pNode.next != null) { if (pNode.next.data == value) { pNode.next = pNode.next.next; continue; } pNode = pNode.next; }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant