反转链表[剑指offer]之python实现
来源:互联网 发布:java thread类的方法 编辑:程序博客网 时间:2024/06/10 02:34
题目描述
输入一个链表,反转链表后,输出链表的所有元素。
题目链接
# -*- coding:utf-8 -*-# class ListNode:# def __init__(self, x):# self.val = x# self.next = Noneclass Solution: # 返回ListNode def ReverseList(self, pHead): # write code here if not pHead or not pHead.next: return pHead else: newHead = self.ReverseList(pHead.next) pHead.next.next=pHead pHead.next=None return newHead
递归的调用
0 0
- 反转链表[剑指offer]之python实现
- python 剑指offer系列:反转链表
- java实现反转链表--《剑指offer》
- 剑指Offer之反转链表
- 剑指Offer之 - 反转链表
- 剑指offer之反转链表
- 【剑指offer】之反转链表
- 剑指offer(十二)之反转链表
- 剑指offer之反转链表
- 剑指offer 之 反转链表
- 剑指offer之十四---反转链表
- 剑指offer刷题之c++实现的反转链表
- 剑指offer:反转链表
- 剑指offer--反转链表
- 剑指offer--反转链表
- 剑指Offer-反转链表
- 《剑指offer》反转链表
- 剑指 offer:反转链表
- EditPlus 自动格式化js、html、css
- c# 读写excel要添加哪些引用
- 大端和小端的区别
- 理解Linux系统负荷
- Java servlet 之间的跳转
- 反转链表[剑指offer]之python实现
- MySQL 没有索引 锁全表
- android屏幕显示布局边框及宽高
- SQL Server2008 列名显示无效
- linux内核源码总览之一---------源代码目录结构说明
- oracle数据库最基本操作
- 深入JVM系列(三)之类加载、类加载器、双亲委派机制与常见问题
- hdu-1205 吃糖果
- FatFs模块系统应用指南