File tree Expand file tree Collapse file tree 3 files changed +55
-0
lines changed
lcci/02.03.Delete Middle Node Expand file tree Collapse file tree 3 files changed +55
-0
lines changed Original file line number Diff line number Diff line change @@ -66,6 +66,26 @@ class Solution {
6666}
6767```
6868
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+
6989### ** ...**
7090
7191```
Original file line number Diff line number Diff line change @@ -60,6 +60,26 @@ class Solution {
6060}
6161```
6262
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+
6383### ** ...**
6484
6585```
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