61. Rotate List
来源:互联网 发布:编程原本 pdf下载 编辑:程序博客网 时间:2024/06/05 22:09
Rotate List
反转列表
代码
public class Solution { public ListNode rotateRight(ListNode head, int k) { if(head == null || k == 0){ return head; } ListNode p = head; int len =1; while(p.next != null){ p = p.next; len++; } p.next = head; k %= len; for(int i = 0; i < (len-k); i++){ p = p.next; } head = p.next; p.next = null; return head; }}
0 0
- [LeetCode]61.Rotate List
- 61. Rotate List
- LeetCode --- 61. Rotate List
- [Leetcode] 61. Rotate List
- 61. Rotate List
- [leetcode] 61.Rotate List
- [leetcode] 61. Rotate List
- 61. Rotate List
- leetcode 61. Rotate List
- LeetCode 61. Rotate List
- [leetcode] 61. Rotate List
- 61. Rotate List
- 61. Rotate List
- 61. Rotate List LeetCode
- leetcode 61. Rotate List
- 61. Rotate List
- 61. Rotate List
- 61. Rotate List
- linux虚拟机桥连配置IP
- 人脸Pose检测:ASM、AAM、CLM总结
- hdu5714 思维+区间内线段最
- 【刷题之路】二叉树上最远距离
- Recommendation Engine classification Intro
- 61. Rotate List
- Android-umeng 微博分享和回调问题
- 排序算法——插入排序
- Thread类的使用
- 配置Nginx实现负载均衡
- 自定义imageView
- ResultSet用法集锦
- 小白第一次在Xcode上配置git与github
- SFIT特征(四)