IrisJavaDiary
Tuesday, March 14, 2017
237. Delete Node in a Linked List
public class Solution {
public void deleteNode(ListNode node) {
if (node == null || node.next == null) {
return;
}
node.val = node.next.val;
node.next = node.next.next;
}
}
No comments:
Post a Comment
‹
›
Home
View web version
No comments:
Post a Comment