voidsetpoint(ListNode* pcursor, int m, int n){ for (int i = 1; ; ++i) { if (i == m - 1) pmptrv = pcursor; elseif (i == m) pm = pcursor; elseif (i == m + 1) { pmnext = pcursor; if (i == n - 1) pnptrv = pcursor; if (i == n) pn = pcursor; } elseif (i == n - 1) pnptrv = pcursor; elseif (i == n) pn = pcursor; elseif (i == n + 1) pnnext = pcursor;
pcursor = pcursor->next; if (!pcursor) break; } }
ListNode* reverseBetween(ListNode* head, int m, int n){ if (moth(head, m, n)) return head;
// ListNode* pcursor = head; setpoint(head, m, n);
if (n - m >= 2) replace_far(); elseif (n - m == 1) replace_close();