8.输入一个链表,输出该链表中倒数第k个结点。
倒数第K个结点就是正数第n-k+1个结点,下标为n-k。
# -*- coding:utf-8 -*-
# class ListNode:
# def __init__(self, x):
# self.val = x
# self.next = None
def FindKthToTail(self, head, k):
# write code here
stack1=[]
p1 = head
if not p1:
return None
else:
while p1:
stack1.ap