You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/main/java/com/fishercoder/solutions/_237.java
+5-11Lines changed: 5 additions & 11 deletions
Original file line number
Diff line number
Diff line change
@@ -2,20 +2,14 @@
2
2
3
3
importcom.fishercoder.common.classes.ListNode;
4
4
5
-
/**237. Delete Node in a Linked List
6
-
*
7
-
Write a function to delete a node (except the tail) in a singly linked list, given only access to that node.
8
-
9
-
Supposed the linked list is 1 -> 2 -> 3 -> 4 and you are given the third node with value 3, the linked list should become 1 -> 2 -> 4 after calling your function.
5
+
/**
6
+
* 237. Delete Node in a Linked List
7
+
* Write a function to delete a node (except the tail) in a singly linked list, given only access to that node.
8
+
* Supposed the linked list is 1 -> 2 -> 3 -> 4 and you are given the third node with value 3,
9
+
* the linked list should become 1 -> 2 -> 4 after calling your function.
10
10
*/
11
11
publicclass_237 {
12
12
13
-
/**We're not really deleting the node, but we're overwriting this node's value with its successor's value,
14
-
* and then append its successor's successor to its new successor.
15
-
*
16
-
* In graph, it's like this:
17
-
* Given this list: 1->2->3->4->null and only access to this to-be-deleted node 3
18
-
* we overwrite 3 with 4, and then assign null to be 4's next.*/
0 commit comments