LintCode之35 翻转链表
来源:互联网 发布:python win32ui 编辑:程序博客网 时间:2024/06/06 04:31
题目来源:翻转链表
题目描述:
翻转一个链表
样例:
给出一个链表1->2->3->null,这个翻转后的链表为3->2->1->null
Java代码:
public ListNode reverse(ListNode head) { // write your code here int count=0; int[] xulie = new int[1000]; ListNode listNode = head; while (listNode!=null) { xulie[count] = listNode.val; listNode = listNode.next; count++; } count--; listNode = head; while (listNode!=null) { listNode.val = xulie[count]; count--; listNode = listNode.next; } return head; }
阅读全文
0 0
- LintCode之35 翻转链表
- lintcode 35 翻转链表
- LintCode 35 翻转链表
- LintCode-翻转链表
- lintcode 翻转链表
- LintCode:翻转链表
- lintcode,翻转链表
- 翻转链表,lintcode
- Lintcode 翻转链表
- LintCode 翻转链表
- 翻转链表-LintCode
- LintCode : 翻转链表
- [Lintcode]翻转链表
- lintcode--翻转链表
- Lintcode翻转链表
- LintCode 翻转链表
- lintcode翻转链表
- LintCode 翻转链表
- 疯狂输出⚔ Java中函数中定义及应用
- Word2Vec训练1
- (7)spring依赖注入引用其它Bean
- 关于Recyclerview使用时的一个错误java.lang.NoSuchMethodError: No static method getMatrix(Landroid/view/View;)
- 键盘监听
- LintCode之35 翻转链表
- 预览器编写语言
- Android 7.0 FileUriExposedException 解决
- could not find java se runtime environment
- 实验吧-逆向-该题不简单
- 基于51单片机的计算器写代码遇到的问题及解决办法
- maven常用的中央仓库
- 训练日记
- C6748_PWM