@@ -0,0 +1,1340 @@
+package coding4fun;%0A%0A/**%0A * Reverse a linked list in-place.%0A * %3Cpre%3E%0A * Input:  1 -%3E 2 -%3E 3 -%3E 4 -%3E 5%0A * Output: 5 -%3E 4 -%3E 3 -%3E 2 -%3E 1%0A * %0A * Input:  1%0A * Output: 1%0A * %3C/pre%3E%0A */%0Apublic class Problem14 %7B%0A    private static class ListNode %7B%0A        int val;%0A        ListNode next;%0A        %0A        ListNode(int val) %7B%0A            this.val = val;%0A        %7D%0A    %7D%0A    %0A    public static ListNode reverse(ListNode l) %7B%0A        ListNode prev = null;%0A        ListNode current = l;%0A        while (current != null) %7B%0A            ListNode next = current.next;%0A            current.next = prev;%0A            prev = current;%0A            current = next;%0A        %7D%0A        return prev;%0A    %7D%0A    %0A    private static void print(ListNode l) %7B%0A        for (ListNode n = l; n != null; n = n.next) %7B%0A            if (n.next == null) %7B%0A                System.out.print(n.val);%0A            %7D else %7B%0A                System.out.print(n.val + %22 -%3E %22);%0A            %7D%0A        %7D%0A        System.out.println();%0A    %7D%0A    %0A    public static void main(String%5B%5D args) %7B%0A        ListNode l = new ListNode(1);%0A        l.next = new ListNode(2);%0A        l.next.next = new ListNode(3);%0A        l.next.next.next = new ListNode(4);%0A        l.next.next.next.next = new ListNode(5);%0A        print(reverse(l));%0A        %0A        l = new ListNode(1);%0A        print(reverse(l));%0A    %7D%0A%7D%0A

Add problem 14