当前位置:网站首页>[Jianzhi offer simple] Jianzhi offer 06 Print linked list from end to end
[Jianzhi offer simple] Jianzhi offer 06 Print linked list from end to end
2022-06-12 21:52:00 【Caicai 2022】
subject
Code
Execution time :116 ms, In all Python3 Defeated in submission 12.70% Users of
Memory consumption :25.8 MB, In all Python3 Defeated in submission 10.26% Users of
Pass the test case :24 / 24
class Solution:
def reversePrint(self, head: ListNode) -> List[int]:
return self.reversePrint(head.next) + [head.val] if head else []
【 Method 2】
Execution time :40 ms, In all Python3 Defeated in submission 67.22% Users of
Memory consumption :16.7 MB, In all Python3 Defeated in submission 29.75% Users of
Pass the test case :24 / 24
class Solution:
def reversePrint(self, head: ListNode) -> List[int]:
ans=[]
while head:
ans.append(head.val)
head=head.next
return ans[::-1]
边栏推荐
- SQL tuning guide notes 16:managing historical optimizer statistics
- Recommended Chinese font in the code input box of Oracle SQL developer
- Can tonghuashun open an account? Is it safe to open an account in tonghuashun? How to open a securities account
- Vagrantbox reinstalling the vboxsf driver
- SQL tuning guide notes 8:optimizer access paths
- Compiling process of OpenSSL and libevent on PC
- The Post-00 financial woman with a monthly salary of 2W conquered the boss with this set of report template
- 2023届校园招聘正式开启!OceanBase 想和你在这个春天约一场面试
- What is the race condition? How do you find and solve the competition?
- Kdd2022 | graphmae: self supervised mask map self encoder
猜你喜欢

A puzzle about + =

PCB封装下载网站推荐及其详细使用方法

Oracle livelabs experiment: introduction to Oracle Spatial

PCB package download website recommendation and detailed usage

Oracle LiveLabs实验:Introduction to Oracle Spatial Studio

Ansible基础和常用模块(一)

建立高可用的数据库

User guide for JUC concurrency Toolkit

SQL tuning guide notes 10:optimizer statistics concepts

Design and practice of Hudi bucket index in byte skipping
随机推荐
Oracle 19c 安装文档
Turing prize winner: what should I pay attention to if I want to succeed in my academic career?
What is embedded
makefile 的ifeq,filter,strip 简单使用
Build a highly available database
Libmysqlclient A static library
Experiment 7-2-6 print Yanghui triangle (20 points)
MySQL介绍和安装(一)
动态规划之如何将问题抽象转化为0-1背包问题(详解利用动态规划求方案数)
MySQL architecture and basic management (II)
#yyds干货盘点# 解决剑指offer:字符流中第一个不重复的字符
User guide for JUC concurrency Toolkit
Economist focuses on WTO MC12: digital economy may become an important issue
NiO User Guide
Ansible summary (VI)
February 27th
复杂系统如何检测异常?北卡UNCC等最新《复杂分布式系统中基于图的深度学习异常检测方法综述》,阐述最新图异常检测技术进展
CVPR 2022 | 应对噪声标签,西安大略大学、字节跳动等提出对比正则化方法
【QNX Hypervisor 2.2 用戶手册】4.2 支持的構建環境
SQL调优指南笔记8:Optimizer Access Paths