1.题目描述
Reverse a linked list from position m to n. Do it in one-pass.
反转从位置 m 到 n 的链表。请使用一趟扫描完成反转。
Note: 1 ≤ m ≤ n ≤ length of list.
Example:
Input: 1->2->3->4->5->NULL, m = 2, n = 4
Output: 1->4->3->2->5->NULL
2.Solutions
1 | public static ListNode reverseBetween(ListNode head, int m, int n) { |