61. 旋转链表 Rotate List

作者: BeijingIamback | 来源:发表于2016-03-08 16:32 被阅读135次

相似题目:旋转数组

Given a list, rotate the list to the right by k places, where k is non-negative.

For example:

Given 1->2->3->4->5->NULL and k = 2,

return 4->5->1->2->3->NULL.

代码:

参考代码

解题思路:组成环形链表,然后找到头结点。

相关文章

网友评论

    本文标题:61. 旋转链表 Rotate List

    本文链接:https://www.haomeiwen.com/subject/ibezkttx.html