LintCode 35 翻转链表
来源:互联网 发布:mac备份文件在哪里 编辑:程序博客网 时间:2024/06/05 22:39
题目:solveNQueens
要求:
翻转一个链表
样例:
给出链表1->2->3->4->5->null, m = 2 和n = 4,返回1->4->3->2->5->null
算法要求:
在原地一次翻转完成
解题思路:
直接翻转即可~~~
算法如下:
ListNode *reverse(ListNode *head) { // write your code here if (head == NULL) { return NULL; } ListNode *t = NULL, *p = head, *q = head->next; while (q != NULL) { p->next = t; t = p; p = q; q = p->next; } p->next = t; return p; }
0 0
- lintcode 35 翻转链表
- LintCode 35 翻转链表
- LintCode-翻转链表
- lintcode 翻转链表
- LintCode:翻转链表
- lintcode,翻转链表
- 翻转链表,lintcode
- Lintcode 翻转链表
- LintCode 翻转链表
- 翻转链表-LintCode
- LintCode : 翻转链表
- [Lintcode]翻转链表
- lintcode--翻转链表
- Lintcode翻转链表
- LintCode 翻转链表
- lintcode翻转链表
- LintCode 翻转链表
- Lintcode:翻转链表
- Spring AOP原理
- 从0到1Android自定义View(二)分类和核心函数
- 2.Guava学习笔记:Guava cache
- 平衡组&递归匹配
- git学习笔记
- LintCode 35 翻转链表
- Linux驱动模块操作命令
- CSDN日报20170423 ——《私活,永远解救不了自己屌丝的人生!》
- Android四大组件简介
- SpringMVC-----SpringMVC静态资源处理
- intellij idea V15 配置
- java 判断成绩及格优秀
- Mysql中的组合查询和UNION操作符
- 算法结构与设计基础作业第八周