Delete Node in a Linked List Solutions in GoNumber 237Difficulty EasyAcceptance 64.0%Link LeetCodeOther languages C++, JavaSolutionsGo solution by halfrost/LeetCode-Gopackage leetcode import ( "github.com/halfrost/LeetCode-Go/structures") // ListNode definetype ListNode = structures.ListNode /** * Definition for singly-linked list. * type ListNode struct { * Val int * Next *ListNode * } */func deleteNode(node *ListNode) { if node == nil { return } cur := node for cur.Next.Next != nil { cur.Val = cur.Next.Val cur = cur.Next } cur.Val = cur.Next.Val cur.Next = nil}package leetcode import ( "github.com/halfrost/LeetCode-Go/structures" ) // ListNode define type ListNode = structures.ListNode /** * Definition for singly-linked list. * type ListNode struct { * Val int * Next *ListNode * } */ func deleteNode(node *ListNode) { if node == nil { return } cur := node for cur.Next.Next != nil { cur.Val = cur.Next.Val cur = cur.Next } cur.Val = cur.Next.Val cur.Next = nil }