标签:code ini fas ast col UNC nod turn nbsp
额,快慢指针,单指针是没必要当作题来做的。
/** * Definition for singly-linked list. * type ListNode struct { * Val int * Next *ListNode * } */ func middleNode(head *ListNode) *ListNode { slow, fast := head, head for fast != nil && fast.Next != nil { slow = slow.Next fast = fast.Next.Next } return slow }
end
标签:code ini fas ast col UNC nod turn nbsp
原文地址:https://www.cnblogs.com/CherryTab/p/12556105.html