Open
Description
// 可重复删除指定value的代码
/*
if (head != null && head.data == value) {
head = head.next;
}
Node pNode = head;
while (pNode != null) {
if (pNode.next.data == data) {
pNode.next = pNode.next.next;
continue;
}
pNode = pNode.next;
}
*/
if (head != null && head.data == value) 这里的if应该改为while,如果连续两个头部的数据是一样 的,删除的也是这个数据,这时候就有出现问题
Metadata
Metadata
Assignees
Labels
No labels