当前位置:网站首页>Leetcode-160 intersecting linked list
Leetcode-160 intersecting linked list
2022-07-01 18:47:00 【It was the sea】

# Definition for singly-linked list.
# class ListNode(object):
# def __init__(self, x):
# self.val = x
# self.next = None
class Solution(object):
def getIntersectionNode(self, headA, headB):
"""
:type head1, head1: ListNode
:rtype: ListNode
"""
p, q = headA, headB
while not p == q:
p = p.next if p else headB
q = q.next if q else headA
return p
边栏推荐
- Basic knowledge and commands of disk
- Operation of cmake under win
- Popular science: what does it mean to enter the kernel state?
- 力扣每日一题-第32天-589.N×树的前序遍历
- ACM MM 2022视频理解挑战赛视频分类赛道冠军AutoX团队技术分享
- 6款红黄黑榜摄像头评测:谁最安全?谁画质好?从此让你不再踩雷
- t10_ Adapting to Market Participantsand Conditions
- C operator overloads the query table
- LeetCode 148. Sort linked list
- 必看,时间序列分析
猜你喜欢

Force buckle day33

研究了11种实时聊天软件,我发现都具备这些功能…

用GSConv+Slim Neck改进Yolov5,将性能提升到极致!

MySQL connection tools

解决方案:可以ping别人,但是别人不能ping我

Evaluation of 6 red, yellow and black list cameras: who is the safest? Who has good picture quality? From now on, let you no longer step on thunder

Calculation of intersection of two line segments

Navicat Premium 15 永久破解和2021版本最新IDEA破解(亲测有效)

Livedata postvalue will "lose" data

3、《创建您自己的NFT集合并发布一个Web3应用程序来展示它们》在本地铸造 NFT
随机推荐
力扣每日一题-第32天-1232. 缀点成线
Lumiprobe bifunctional crosslinker sulfo cyanine 5 bis NHS ester
R语言ggplot2可视化:gganimate创建动态柱状图动画(gif)、在动画中沿给定维度逐步显示柱状图、enter_grow函数和enter_fade函数控制运动内插退出(渐变tweening)
What if the reliability coefficient is low? How to calculate the reliability coefficient?
用WPF写一款开源方便、快捷的数据库文档查询、生成工具
PTA year of birth
Relational database management system of easyclick
(6) VIM editor MV cat redirection standard input and output more pipe symbols head tail
Blue Bridge Cup real topic: the shortest circuit
Bernoulli distribution (a discrete distribution)
Localization through custom services in the shuttle application
Memo - about C # generating barcode for goods
NSI packaging script add file details
磁盘的基本知识和基本命令
《Go题库·16》读写锁底层是怎么实现的
How to operate technology related we media well?
[acnoi2022] color ball
golang 错误处理
每周推薦短視頻:警惕“現象”與“問題”相互混淆
创建您自己的NFT集合并发布一个Web3应用程序来展示它们(介绍)