您的位置:首页 > 其它

61. Rotate List

2017-02-15 19:12 190 查看
Total Accepted: 96273
Total Submissions: 399212
Difficulty: Medium
Contributors: Admin

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
.

来源: https://leetcode.com/problems/rotate-list/

分析

这里题目的 test case 有一个没有说清楚的条件,就是当 k > list.size ,怎么处理, 实际上题目是取模的
null
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: