使用双指针

function FindKthToTail( pHead ,  k ) {
    // write code here
    let fast = pHead, slow = pHead;

    while (fast && k > 0) {
        [fast, k] = [fast.next, k - 1];
    }

    //如果k大于链表长度
    if(k > 0) return null;

    while (fast) {
        [fast, slow] = [fast.next, slow.next];
    }
    return slow;
}
module.exports = {
    FindKthToTail : FindKthToTail
};