public ListNode reverseBetween(ListNode head, int m, int n) {
		if (m == n)
			return head;

		ListNode leftLast = null, mPointer = null, nPointer = null;
		int count = 0;
		ListNode current = head;
		while (current != null) {
			count++;
			if (count == m) {
				mPointer = current;
			}
			if (count == n) {
				nPointer = current;
				break;
			}
			if (count < m) {
				leftLast = current;
			}
			current = current.next;
		}

		ListNode rightHead = nPointer.next;
		ListNode tmp = null;
		while (true) {
			tmp = mPointer.next;
			mPointer.next = rightHead;
			rightHead = mPointer;

			if (mPointer == nPointer) {
				break;
			}
			mPointer = tmp;
		}

		if (leftLast == null) {
			return rightHead;
		} else {
			leftLast.next = rightHead;
			return head;
		}

	}