Face questions twenty-two: the list penultimate k nodes

 

Method a : Method two pointers define the double pointer A, B, A k-1 step and then go down together until A.next == null
Note:
1. The list is empty
2. chain length is less than K
3.K < = 0

Guess you like

Origin www.cnblogs.com/niliuxiaocheng/p/12592244.html