题目描述
输入一个链表,输出该链表中倒数第k个结点。
class Solution:
def FindKthToTail(self, head, k):
# 12345
front_node = head
behind_node = head
# 2 front_node = 2
for i in range(k):
if front_node == None:
return None
front_node = front_node.next
while front_node:
front_node = front_node.next
behind_node = behind_node.next
return behind_node