private ListNode reverse(ListNode head) {
            ListNode pre = null;
            ListNode p = head;
            while (p != null) {
                ListNode temp = p.next;
                p.next = pre;
                pre = p;
                p = temp;
            }
            return pre;
        }