设置两个节点指针,并且确定好边界条件。
def findKchain(head, k):
first_point = head
second_point = head
for i in range(k):
#边界条件很重要
if first_point==None:
return None
first_point = first_point.next
while first_point != None:
first_point = first_point.next
second_point = second_point.next
return second_point.val