public static ListNode reverseBetween(ListNode head, int m, int n) {//AC
        if (head == null || head.next == null) return head;
        ListNode dummy = new ListNode(0);
        dummy.next = head;
        ListNode p_prev = dummy;
        ListNode p_post;
        int len = n - m;
        while (m > 1) {
            p_prev = p_prev.next;
            --m;
        }
        ListNode p = p_prev.next;
        while (len > 0) {
            p_post = p.next;
            p.next = p_post.next;
            p_post.next = p_prev.next;
            p_prev.next = p_post;
            --len;
        }
        return dummy.next;
    }