92. Reverse Linked List II
problem description
Reverse a linked list from position m to n. Do it in one-pass.
Note: 1 ≤ m ≤ n ≤ length of list.
Example:
algorithm thought
首先找到待旋转的节点,然后就是一个旋转链表问题了
code
algorithm analysis
对链表进行一次遍历,转置,循环中操作都是O(1),最后时间复杂度O(n)
Last updated