Jan 12 - Delete Node in a Linked List; Data Structure; Linked List; Pointer;
生活随笔
收集整理的這篇文章主要介紹了
Jan 12 - Delete Node in a Linked List; Data Structure; Linked List; Pointer;
小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.
代碼:
/*** Definition for singly-linked list.* public class ListNode {* int val;* ListNode next;* ListNode(int x) { val = x; }* }*/ public class Solution {public void deleteNode(ListNode node) {if(node == null) return;while(node.next != null){node.val = node.next.val;if(node.next.next != null){node = node.next;}else{node.next = null;}}node = node.next;} }
轉(zhuǎn)載于:https://www.cnblogs.com/5683yue/p/5126136.html
總結(jié)
以上是生活随笔為你收集整理的Jan 12 - Delete Node in a Linked List; Data Structure; Linked List; Pointer;的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 长虹发布8K巨幕电视Q9K MAX:75
- 下一篇: AMD服务器CPU翻身:堪比20年前赢得