题目

LeetCode--237--删除链表中的节点

代码

/**
 * Definition for singly-linked list.
 * public class ListNode {
 *     int val;
 *     ListNode next;
 *     ListNode(int x) { val = x; }
 * }
 */
class Solution {
    public void deleteNode(ListNode node) {
        if(node.next != null){
            node.val = node.next.val;
            node.next = node.next.next;
        }
    }
}

相关文章:

  • 2021-06-01
  • 2021-11-10
  • 2021-09-25
  • 2022-01-09
  • 2021-08-30
  • 2021-06-02
  • 2021-12-25
  • 2022-01-11
猜你喜欢
  • 2021-04-07
  • 2021-06-19
  • 2022-12-23
  • 2021-09-15
  • 2022-12-23
  • 2021-12-09
相关资源
相似解决方案