class Solution {
public:
ListNode* FindKthToTail(ListNode* pListHead, unsigned int k) {
ListNode *fast=pListHead;
ListNode *slow=pListHead;
while(k--){
if(fast)
fast=fast->next;
else
return NULL;
}
while(fast){
slow=slow->next;
fast=fast->next;
}
return slow;
}
};
京公网安备 11010502036488号