给定一个单向链表中的某个节点,请删除这个节点,但要求只能访问该节点。若该节点为尾节点,返回false,否则返回true
加载中...
import java.util.*; /* public class ListNode { int val; ListNode next = null; ListNode(int val) { this.val = val; } }*/ public class Remove { public boolean removeNode(ListNode pNode) { // write code here } }
/* struct ListNode { int val; struct ListNode *next; ListNode(int x) : val(x), next(NULL) {} };*/ class Remove { public: bool removeNode(ListNode* pNode) { // write code here } };
# -*- coding:utf-8 -*- # class ListNode: # def __init__(self, x): # self.val = x # self.next = None class Remove: def removeNode(self, pNode): # write code here
/* public class ListNode { public int val; public ListNode next; public ListNode (int x) { val = x; } }*/ class Remove { public bool removeNode(ListNode pNode) { // write code here } }