@@ -0,0 +1,749 @@
+package com.matao;%0A%0Aimport com.matao.common.ListNode;%0A%0A/**%0A * Created by matao on 2019-01-06.%0A * %3Cp%3E%0A * %E6%B1%82%E9%93%BE%E8%A1%A8%E4%B8%AD%E5%80%92%E6%95%B0%E7%AC%ACk%E4%B8%AA%E8%8A%82%E7%82%B9%E3%80%82%E9%93%BE%E8%A1%A8%E7%9A%84%E5%B0%BE%E8%8A%82%E7%82%B9%E5%AE%9A%E4%B9%89%E4%B8%BA%E5%80%92%E6%95%B0%E7%AC%AC1%E4%B8%AA%E8%8A%82%E7%82%B9%E3%80%82%0A */%0Apublic class Q22_KthNodeFromEnd %7B%0A%0A    /**%0A     * %E5%8F%8C%E6%8C%87%E9%92%88%EF%BC%8C%E7%AC%AC%E4%B8%80%E4%B8%AA%E6%8C%87%E9%92%88%E5%85%88%E8%B5%B0k-1%E6%AD%A5%0A     */%0A    public static ListNode%3CInteger%3E findKthToTail(ListNode%3CInteger%3E head, int k) %7B%0A        if (head == null %7C%7C k %3C= 0) %7B%0A            return null;%0A        %7D%0A%0A        ListNode%3CInteger%3E slow = head, fast = head;%0A        for (int i = 0; i %3C k; i++) %7B%0A            if (fast.next != null %7C%7C i == k - 1) %7B%0A                fast = fast.next;%0A            %7D else %7B%0A                return null;%0A            %7D%0A        %7D%0A%0A        while (fast != null) %7B%0A            slow = slow.next;%0A            fast = fast.next;%0A        %7D%0A        return slow;%0A    %7D%0A%7D%0A

add Q22 KthNodeFromEnd