偷懒做法…
class Solution {
public:
ListNode* findKthToTail(ListNode* p, int k) {
vector<int> res;
int length = 0;
while(p){
length++;
res.push_back(p->val);
p = p->next;
}
if(k > length) return NULL;
auto l = new ListNode(-1);
l->val = res[length - k];
return l;
}
};