public ListNode FindKthToTail (ListNode pHead, int k) { // write code here if (pHead == null || k < 1) { return null; } // 快指针 ListNode fast = pHead; // 找列表中的第k个节点 for (int i = 1; i < k; i++) { fast = fast.next; // 列表长度小于k if (fast == null) { return null; } } // 慢指针 ListNode slow = pHead; while (fast.next != null) { fast = fast.next; slow = slow.next; } return slow; }