标签:col 链表 输出 turn desc scribe tno next bsp
/* public class ListNode { int val; ListNode next = null; ListNode(int val) { this.val = val; } }*/ public class Solution { public ListNode FindKthToTail(ListNode head,int k) { if(head == null){ return null; } ListNode P1 = head; while(P1 != null && k-- > 0) { P1 = P1.next; } if(k > 0) return null; ListNode P2 = head; while(P1 != null) { P1 = P1.next; P2 = P2.next; } return P2; } }
标签:col 链表 输出 turn desc scribe tno next bsp
原文地址:https://www.cnblogs.com/Roni-i/p/10371960.html