@@ -0,0 +1,914 @@
+package com.ttaylorr.ctci.answers.linked_lists;%0A%0Aimport com.ttaylorr.ctci.answers.linked_lists.util.LinkedList;%0Aimport com.ttaylorr.ctci.meta.Solution;%0A%0A@Solution(chapter = 2, problem = 3)%0Apublic class NthToLastElement%3CE%3E %7B%0A    protected final LinkedList.Node%3CE%3E head;%0A    protected final int n;%0A%0A    public NthToLastElement(LinkedList.Node%3CE%3E head, int n) %7B%0A        this.head = head;%0A        this.n = n;%0A    %7D%0A%0A    public LinkedList.Node%3CE%3E get() %7B%0A        LinkedList.Node%3CE%3E a = this.head;%0A        LinkedList.Node%3CE%3E b = null;%0A%0A        // Space the two pointers out by %60n%60 degrees of sepration%0A        for (int i = 0; i %3C n; i++) b = (b == null) ? a : b.next();%0A%0A        // Increase them both until we hit the end of the list%0A        while ((b = b.next()) != null) %7B%0A            a = a.next();%0A        %7D%0A%0A        // Once we've done that, return the one further from the end of the list.%0A        return a;%0A    %7D%0A%7D%0A

Add NthToLastNode problem from chapter 2