public class Solution {
public ListNode FindKthToTail(ListNode head,int k) {
if(head == null) return head;
// 肯定要遍历一次,获取整个链表的长度
int count = 0;
ListNode node = head;
while(node != null){
node = node.next;
count++;
}
if(count < k) return null;
for(int i=0;i<count-k;i++){
head = head.next;
}
return head;
}
}