[LeetCode] Reverse Linked List II
生活随笔
收集整理的這篇文章主要介紹了
[LeetCode] Reverse Linked List II
小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.
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.
此題在上題的基礎上加了位置要求,只翻轉(zhuǎn)指定區(qū)域的鏈表。由于鏈表頭節(jié)點不確定,使用dummy節(jié)點。。
?
轉(zhuǎn)載于:https://www.cnblogs.com/immjc/p/7779011.html
總結(jié)
以上是生活随笔為你收集整理的[LeetCode] Reverse Linked List II的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 快速排序算法的实现 随机生成区间里的数
- 下一篇: 嫣然一笑II