public ListNode reverseBetween2(ListNode head, int m, int n) {
        // Note: The Solution object is instantiated only once and is reused by each test case.
        if ( m == n || n == 1){
            return head;
        }
        ListNode tmpHead = new ListNode(0);
        tmpHead.next = head;
        ListNode tmp = head;
        int i = 1;
        for (; i < m; ++i){
            tmpHead = tmpHead.next;
            tmp = tmp.next;
        }
        for (;i < n; ++i){
            ListNode tmpBack = tmp.next;
            tmp.next = tmpBack.next;
            tmpBack.next = tmpHead.next;
            tmpHead.next = tmpBack;
        }
		return m == 1? tmpHead.next : head;
    }