mirror of
https://github.com/halfrost/LeetCode-Go.git
synced 2025-07-24 10:37:33 +08:00
规范格式
This commit is contained in:
@ -0,0 +1,28 @@
|
||||
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
|
||||
}
|
Reference in New Issue
Block a user