public class Solution { public ListNode FindKthToTail(ListNode head,int k) { if (head == null) { return null; } ListNode first = head; int length = 0; while (first != null) { length++; first = first.next; } first = head; if (length >= k) { for (int i = 0; i < length - k ; i++) { first = first.next; } return first; }else { return null; } } }
原文:https://www.cnblogs.com/q-1993/p/10544066.html