@@ -0,0 +1,937 @@
+package leetcode;%0A%0Aimport java.util.Stack;%0A%0A/**%0A * https://leetcode.com/problems/reverse-linked-list/%0A */%0Apublic class Problem206 %7B%0A    public static class ListNode %7B%0A        int val;%0A        ListNode next;%0A%0A        ListNode(int x) %7B%0A            val = x;%0A        %7D%0A    %7D%0A%0A    public ListNode reverseList(ListNode head) %7B%0A        Stack%3CListNode%3E stack = new Stack%3C%3E();%0A        for (ListNode node = head ; node != null; node = node.next) %7B%0A            stack.push(node);%0A        %7D%0A        ListNode n1 = null;%0A        ListNode n2 = null;%0A        ListNode newHead = null;%0A        while (!stack.isEmpty()) %7B%0A            n1 = stack.pop();%0A            if (newHead == null) %7B%0A                newHead = n1;%0A            %7D%0A            if (stack.isEmpty()) %7B%0A                break;%0A            %7D%0A            n2 = stack.pop();%0A            n1.next = n2;%0A            n2.next = null;%0A            stack.push(n2);%0A        %7D%0A        return newHead;%0A    %7D%0A%7D%0A

Solve problem 206