File tree 3 files changed +55
-0
lines changed
lcci/02.03.Delete Middle Node
3 files changed +55
-0
lines changed Original file line number Diff line number Diff line change @@ -66,6 +66,26 @@ class Solution {
66
66
}
67
67
```
68
68
69
+ ### ** JavaScript**
70
+
71
+ ``` js
72
+ /**
73
+ * Definition for singly-linked list.
74
+ * function ListNode(val) {
75
+ * this.val = val;
76
+ * this.next = null;
77
+ * }
78
+ */
79
+ /**
80
+ * @param {ListNode} node
81
+ * @return {void} Do not return anything, modify node in-place instead.
82
+ */
83
+ var deleteNode = function (node ) {
84
+ node .val = node .next .val
85
+ node .next = node .next .next
86
+ };
87
+ ```
88
+
69
89
### ** ...**
70
90
71
91
```
Original file line number Diff line number Diff line change @@ -60,6 +60,26 @@ class Solution {
60
60
}
61
61
```
62
62
63
+ ### ** JavaScript**
64
+
65
+ ``` js
66
+ /**
67
+ * Definition for singly-linked list.
68
+ * function ListNode(val) {
69
+ * this.val = val;
70
+ * this.next = null;
71
+ * }
72
+ */
73
+ /**
74
+ * @param {ListNode} node
75
+ * @return {void} Do not return anything, modify node in-place instead.
76
+ */
77
+ var deleteNode = function (node ) {
78
+ node .val = node .next .val
79
+ node .next = node .next .next
80
+ };
81
+ ```
82
+
63
83
### ** ...**
64
84
65
85
```
Original file line number Diff line number Diff line change
1
+ /**
2
+ * Definition for singly-linked list.
3
+ * function ListNode(val) {
4
+ * this.val = val;
5
+ * this.next = null;
6
+ * }
7
+ */
8
+ /**
9
+ * @param {ListNode } node
10
+ * @return {void } Do not return anything, modify node in-place instead.
11
+ */
12
+ var deleteNode = function ( node ) {
13
+ node . val = node . next . val
14
+ node . next = node . next . next
15
+ } ;
You can’t perform that action at this time.
0 commit comments