leetcode-Reverse Linked List
2015-11-04 22:11
357 查看
思想:将节点一个个插入到前一个节点前面。
public class Solution { public ListNode reverseList(ListNode head) { if(head==null) return head; ListNode t=null,q; while(head.next!=null) { q=head.next; head.next=t; t=head; head=q; } head.next=t; return head; } }
相关文章推荐
- .net关于httpModules的应用示例
- Multiply Strings
- 上传文件中使用ajaxfileupload.js碰到的问题
- 解析Android ListView工作原理及其缓存机制
- lightoj 1214 - Large Division 【判大数整除 拆分字符串 同余】
- iOS开发-常用第三方开源框架介绍(你了解的ios只是冰山一角)
- 字符串之数字子串求和
- 数据库查询的基础技巧
- Linux命令——unalias
- 强联通分量-Gabow
- ASP.NET WebAPI 09 Controller的激活
- Activity优化几个结束的方法
- having——至少被订购过两回的订单
- READING NOTE: Learning to Segment Moving Objects in Videos
- set、env、export――Linux中的环境变量命令
- 转载
- 【五校联考】集体照
- 在伪分布式环境下通过宿主机上的eclipse运行WordCount小程序出现的问题小结
- hdoj 1087Super Jumping! Jumping! Jumping!【dp】
- Linux下/proc目录简介