arrow_back Back to Challenges

#160 Intersection of Two Linked Lists

Easy Acceptance 0%
description

Problem Description

Given the heads of two singly linked-lists `headA` and `headB`, return the node at which the two lists intersect. If the two linked lists have no intersection at all, return `null`.

checklist Constraints

The number of nodes of listA is in the m.
The number of nodes of listB is in the n.
1 <= m, n <= 3 * 10^4
1 <= Node.val <= 10^5

science Examples

Case #1

In: listA = [4,1,8,4,5] listB = [5,6,1,8,4,5]
Out: 8

Case #2

In: listA = [2,6,4] listB = [1,5]
Out: null

Mastery Tags

Linked List Two Pointers

Hiring Companies

Amazon Bloomberg Meta
code

Integrated IDE

code_blocks
Coding
psychology
Aptitude