给定一个单向链表中的某个节点,请删除这个节点,但要求只能访问该节点。若该节点为尾节点,返回false,否则返回true
public class Remove {
public boolean removeNode(ListNode pNode) {
// write code here
if (pNode == null) {
return false;
}
if (pNode.next == null) {
pNode = null;
return false;
} else {
pNode = pNode.next;
}
return true;
}
}