public static ListNode reverseBetween(ListNode head, int m, int n) {
		if (head == null || head.next == null)
			return head;

		ListNode result = new ListNode(0);
		result.next = head;
		head = result;
		ListNode pre = head, cur = head, post = head;
		int index = 1;

		while (index < m) {
			pre = pre.next;
			index++;
		}
		cur = pre.next;
		post = cur.next;
		index = m;
		while (post != null && index < n) {
			index++;
			ListNode temp = post.next;
			post.next = pre.next;
			pre.next = post;
			cur.next = temp;
			post = temp;

		}
		return head.next;

	}