python 剑指offer系列:反转链表
来源:互联网 发布:淘宝店刷信誉可靠吗 编辑:程序博客网 时间:2024/05/21 12:50
题目:输入一个链表,反转链表后,输出链表的所有元素。
代码:
# -*- coding:utf-8 -*-# class ListNode:# def __init__(self, x):# self.val = x# self.next = Noneclass Solution: # 返回ListNode def ReverseList(self, head): # write code here tmp = None while head: cur = head.next head.next = tmp tmp = head head = cur return tmp
阅读全文
0 0
- python 剑指offer系列:反转链表
- 剑指offer系列源码-反转链表
- 【剑指offer系列】 反转链表___16
- 剑指offer系列之十四:反转链表
- 剑指offer系列之14:反转链表
- 剑指Offer系列-面试题16:反转链表
- 【剑指offer-解题系列(15)】反转链表
- 反转链表[剑指offer]之python实现
- 剑指offer:反转链表
- 剑指offer--反转链表
- 剑指offer--反转链表
- 剑指Offer-反转链表
- 《剑指offer》反转链表
- 剑指 offer:反转链表
- 剑指offer-反转链表
- 剑指offer 反转链表
- 剑指offer-反转链表
- 剑指offer:反转链表
- Boolean.getBoolean(String name)
- JavaWeb的四大域对象总结
- uboot分析之 usb启动
- <转>JAVA精确的浮点数运算
- 微信开发3-------------------------------获得每天用户关注/取关/总人数的统计
- python 剑指offer系列:反转链表
- ScrollView嵌套RecyclerView显示不全
- Java虚拟机
- redis入门篇
- udp_server
- Codeforces 371E Subway Innovation【思维+前缀和】
- Linux安装telnet
- 详述用html5 canvas实现的类似于天猫的购物进度反馈/订单跟踪
- python学习(15)——常见错误集锦