Created
December 15, 2022 23:32
-
-
Save abdulrahmanAlotaibi/b000361610327b552cca745cf113d6c9 to your computer and use it in GitHub Desktop.
Linkedlist: Delete Node in a Linked List
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Definition for singly-linked list. | |
* type ListNode struct { | |
* Val int | |
* Next *ListNode | |
* } | |
*/ | |
func deleteNode(node *ListNode) { | |
node.Val = node.Next.Val | |
node.Next = node.Next.Next | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment