【LeetCode】 61. Rotate List C语言
来源:互联网 发布:godaddy虚拟主机 java 编辑:程序博客网 时间:2024/06/07 02:04
LeetCode解题心得,欢迎交流! 第二日
/** * Definition for singly-linked list. * struct ListNode { * int val; * struct ListNode *next; * }; */struct ListNode* rotateRight(struct ListNode* head, int k) { if(head == NULL) return head; struct ListNode *new_head=head; struct ListNode *tail=head; int i,length=1; while(tail->next !=NULL) { length++; tail=tail->next; } tail->next=head; // circle the link if(k=k%length) { for(i=0;i<length-k;i++) { tail=tail->next; } } new_head=tail->next; tail->next=NULL; return new_head;}
0 0
- 【LeetCode】 61. Rotate List C语言
- [C语言][LeetCode][61]Rotate List
- [LeetCode]61.Rotate List
- LeetCode --- 61. Rotate List
- [Leetcode] 61. Rotate List
- [leetcode] 61.Rotate List
- [leetcode] 61. Rotate List
- leetcode 61. Rotate List
- LeetCode 61. Rotate List
- [leetcode] 61. Rotate List
- 61. Rotate List LeetCode
- leetcode 61. Rotate List
- LeetCode 61. Rotate List
- leetcode 61. Rotate List
- [LeetCode]61. Rotate List
- LeetCode 61. Rotate List
- LeetCode *** 61. Rotate List
- LeetCode 61. Rotate List
- L1-030. 一帮一 java
- "as" in Swift
- 【React Native开发】
- socket 简单理解
- js中如何通过单击事件获取当前对象,并传递当前对象到函数中?
- 【LeetCode】 61. Rotate List C语言
- Matlab 图像压缩编码—代码内容
- 逆向打印、销毁、查找结点之递归实现
- h5 移动端适配3中方式
- c++中的栈、stack的初步应用
- jeecg框架中时间控件时分秒的显示
- 网络流24题 飞行员配对
- ES安装以及使用
- L1-031. 到底是不是太胖了 java