class ListNode:
def __init__(self, x):
self.val = x
self.next = None
class Solution:
def FindKthToTail(self , pHead: ListNode, k: int) -> ListNode:
first = pHead
second = pHead
n = 0
while n < k and first:
first = first.next
n += 1
if first is None and n < k:
return None
while first:
second = second.next
first = first.next
return second

京公网安备 11010502036488号