92 Reverse Linked List II
1. Question
Reverse a linked list from positionmton. Do it in-place and in one-pass.
For example:
Given1->2->3->4->5->NULL
,m= 2 andn= 4,
return1->4->3->2->5->NULL
.
Note: Givenm,nsatisfy the following condition: 1 ≤m≤n≤ length of list.
2. Implementation
3. Time & Space Complexity
时间复杂度O(m - n + 1), 空间复杂度O(1)
Last updated