当前位置:网站首页>LeetCode-21合并两个有序链表
LeetCode-21合并两个有序链表
2022-07-01 18:33:00 【原来是大海】

# Definition for singly-linked list.
# class ListNode(object):
# def __init__(self, val=0, next=None):
# self.val = val
# self.next = next
class Solution(object):
def mergeTwoLists(self, list1, list2):
"""
:type list1: Optional[ListNode]
:type list2: Optional[ListNode]
:rtype: Optional[ListNode]
"""
chushihua = ListNode(0)
new = chushihua
while list1 and list2:
if list1.val <= list2.val:
new.next =list1
list1 = list1.next
else:
new.next = list2
list2 = list2.next
new = new.next
new.next = list1 if list1 is not None else list2
return chushihua.next
边栏推荐
- Subnet division and summary
- PMP daily three questions (February 15, 2022)
- 540. Single element in ordered array
- Session layer of csframework, server and client (1)
- Cloud computing - make learning easier
- Data query language (DQL)
- Growing up in the competition -- (Guangyou's most handsome cub) Pikachu walking
- 聊聊项目经理最爱使用的工具
- Unity learning fourth week
- A database editing gadget that can edit SQLite database. SQLite database replaces fields. SQL replaces all values of a field in the database
猜你喜欢

每周推荐短视频:警惕“现象”与“问题”相互混淆

Five degrees easy chain enterprise app is newly upgraded

Highly reliable program storage and startup control system based on anti fuse FPGA and QSPI flash

Debiasing word embeddings | talking about word embedding and deviation removal # yyds dry goods inventory #
![[today in history] February 15: Pascal's father was born; YouTube was founded; Kotlin language comes out](/img/f3/20b73f3545cdd17b9fbc52bf493ab4.jpg)
[today in history] February 15: Pascal's father was born; YouTube was founded; Kotlin language comes out

信度系数低怎么办?信度系数具体怎么算?

Depth first search - DFS (burst search)

Quick foundation of group theory (5): generators, Kelley graphs, orbits, cyclic graphs, and "dimensions" of groups?

Mysql database of easyclick

PCL learning materials
随机推荐
MySQL connection tools
The latest software scheme of the intelligent information management system of the armed police force
MFC obtains local IP (used more in network communication)
Operating system interview assault
EasyCVR通过国标GB28181协议接入设备,出现设备自动拉流是什么原因?
Sanfeng cloud 0215 I often use
Thread forced join, thread forced join application scenarios
Growing up in the competition -- (Guangyou's most handsome cub) Pikachu walking
. Net cloud native architect training camp (permission system code implements actionaccess) -- learning notes
Nielseniq found that 60% of the re launched products had poor returns
Localization through custom services in the shuttle application
Develop those things: add playback address authentication to easycvr platform
How to find customers for investment attraction in industrial parks
How to manage 1000 anchors by one person?
Happy new year | 202112 monthly summary
Samba basic usage
Talk about the favorite tools used by project managers
Force buckle day33
聊聊项目经理最爱使用的工具
Implementation of converting PCM file to WAV