# -*- coding:utf-8 -*-
# class ListNode:
# def __init__(self, x):
# self.val = x
# self.next = None
class Solution:
def FindKthToTail(self, head, k):
# write code here
d=[]
if not head:
return None
count=0
while head:
d.append(head)
head=head.next
count+=1
if k>count or k<1:
return
return d[-k]
剑指offer-链表中倒数第k个结点(python)
猜你喜欢
转载自blog.csdn.net/qq_42738654/article/details/104224699
今日推荐
周排行