go + 快慢指针
func FindKthToTail( pHead *ListNode , k int ) *ListNode { // write code here if pHead == nil { return pHead } slow, fast := pHead, pHead // 先找到正序 第k个节点 for i:=0; i < k; i++{ if fast == nil { return nil } fast = fast.Next } // 然后快慢指针同时向后移动,快指针为nil时, slow就是倒数第k个 for fast != nil { slow =slow.Next fast = fast.Next } return slow }