https://leetcode.com/explore/interview/card/top-interview-questions-easy/93/linked-list/553/
/**
* Definition for singly-linked list.
* function ListNode(val) {
* this.val = val;
* this.next = null;
* }
*/
/**
* @param {ListNode} node
* @return {void} Do not return anything, modify node in-place instead.
*/
var deleteNode = function(node) {
node.val = node.next.val;
node.next = node.next.next;
};
GitHub : https://github.com/developeSHG/Algorithm-LeetCode/tree/main/delete-node-in-a-linked-list
'Coding Test > LeetCode' 카테고리의 다른 글
[LeetCode] (Sorting and Searching) Lv Easy. Merge Sorted Array (0) | 2023.01.22 |
---|---|
[LeetCode] (Trees) Lv Easy. Maximum Depth of Binary Tree (0) | 2023.01.21 |
[LeetCode] (Strings) Lv Easy. Reverse Integer (0) | 2023.01.16 |
[LeetCode] (Array) Lv Easy. Best Time to Buy and Sell Stock II (0) | 2023.01.16 |
[LeetCode] (Array) Lv Easy. Remove Duplicates from Sorted Array (0) | 2023.01.14 |
댓글