File tree 2 files changed +28
-0
lines changed
2 files changed +28
-0
lines changed Original file line number Diff line number Diff line change 52
52
219|[ Contains Duplicate II] ( ./0219-contains-duplicate-ii.js ) |Easy|
53
53
226|[ Invert Binary Tree] ( ./0226-invert-binary-tree.js ) |Easy|
54
54
234|[ Palindrome Linked List] ( ./0234-palindrome-linked-list.js ) |Easy|
55
+ 237|[ Delete Node in a Linked List] ( ./0237-delete-node-in-a-linked-list.js ) |Easy|
55
56
242|[ Valid Anagram] ( ./0242-valid-anagram.js ) |Easy|
56
57
263|[ Ugly Number] ( ./0263-ugly-number.js ) |Easy|
57
58
264|[ Ugly Number II] ( ./0264-ugly-number-ii.js ) |Medium|
Original file line number Diff line number Diff line change
1
+ /**
2
+ * 237. Delete Node in a Linked List
3
+ * https://leetcode.com/problems/delete-node-in-a-linked-list/
4
+ * Difficulty: Easy
5
+ *
6
+ * Write a function to delete a node in a singly-linked list. You will not be
7
+ * given access to the head of the list, instead you will be given access to
8
+ * the node to be deleted directly.
9
+ *
10
+ * It is guaranteed that the node to be deleted is not a tail node in the list.
11
+ */
12
+
13
+ /**
14
+ * Definition for singly-linked list.
15
+ * function ListNode(val) {
16
+ * this.val = val;
17
+ * this.next = null;
18
+ * }
19
+ */
20
+ /**
21
+ * @param {ListNode } node
22
+ * @return {void } Do not return anything, modify node in-place instead.
23
+ */
24
+ var deleteNode = function ( node ) {
25
+ node . val = node . next . val ;
26
+ node . next = node . next . next ;
27
+ } ;
You can’t perform that action at this time.
0 commit comments