[LeetCode] Reverse Linked List II
生活随笔
收集整理的这篇文章主要介绍了
[LeetCode] Reverse Linked List II
小编觉得挺不错的,现在分享给大家,帮大家做个参考.
Reverse a linked list from position m to n. Do it in-place and in one-pass.
For example:
Given 1->2->3->4->5->NULL, m = 2 and n = 4,
return 1->4->3->2->5->NULL.
Note:
Given m, n satisfy the following condition:
1 ≤ m ≤ n ≤ length of list.
此题在上题的基础上加了位置要求,只翻转指定区域的链表。由于链表头节点不确定,使用dummy节点。。
转载于:https://www.cnblogs.com/immjc/p/7779011.html
总结
以上是生活随笔为你收集整理的[LeetCode] Reverse Linked List II的全部内容,希望文章能够帮你解决所遇到的问题。
- 上一篇: 快速排序算法的实现 随机生成区间里的数
- 下一篇: 嫣然一笑II