reverse a linked list from position m to n. do it in-place and in one-pass.
for example:
given <code>1->2->3->4->5->null</code>, m = 2 and n = 4,
return <code>1->4->3->2->5->null</code>.
note:
given m, n satisfy the following condition:
1 ≤ m ≤ n ≤ length of list.
是以,隻需将m到n部分翻轉,然後将m的字首beforem指向該部分反轉後的頭結點即可。如果beforem為null,則m=1,m到n部分的頭結點即為連結清單的頭結點。