FastPrepFind the Intersection Node of Two Linked Lists
Problems/Find the Intersection Node of Two Linked Lists

Find the Intersection Node of Two Linked Lists

Bloomberg LP logoBloomberg LP● EasyNEW GRADPHONE SCREEN

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: Reported in a firsthand Bloomberg new-grad interview, across a phone screen and an onsite. The task is to find the first node the two lists share. Two nodes are the same only if they are the same node, not just equal values.

Two acyclic singly linked lists are stored in one node table. Node i points to node next[i]; a value of -1 means that the node has no successor. The integers headA and headB are the head-node indices, or -1 for an empty list.

Return the index of the first node that is reachable from both heads. Intersection is based on node identity, not equal values. Once the lists reach the same node, they share the remaining suffix. Return -1 if they do not intersect.

Function

findIntersectionNode(next: int[], headA: int, headB: int) → int

Examples

Example 1

next = [1,2,3,-1,2]headA = 0headB = 4return = 2

The first list follows 0 -> 1 -> 2 -> 3, while the second follows 4 -> 2 -> 3. Their first shared node is index 2.

Example 2

next = [1,-1,3,-1]headA = 0headB = 2return = -1

The two chains end separately, so there is no shared node.

Example 3

next = [1,2,-1]headA = 0headB = 0return = 0

Both lists start at the same node, so that head is the intersection.

Constraints

  • 0 <= next.length <= 200000
  • Every entry of next is -1 or a valid node index.
  • Each chain reachable from headA or headB is acyclic.
  • Each head is -1 or a valid node index.

More Bloomberg LP Phone Screen questions

  • Pascal's TrianglePHONE SCREEN · ONSITE INTERVIEW · Seen Dec 2026
  • Valid Triangle NumberPHONE SCREEN · ONSITE INTERVIEW · Seen Dec 2026
  • Collatz Conjecture with Shared MemoizationPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Word SearchOA · PHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • N-ary Index-Path Encoder and DecoderPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Trapping Rain WaterPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Fewest Coins CombinationPHONE SCREEN · Seen Nov 2026
  • Recommend Films from Viewers Who Watched Everything You DidPHONE SCREEN · Seen Nov 2026
  • Track New Values in Sorted OrderPHONE SCREEN · Seen Nov 2026
  • Design Browser HistoryPHONE SCREEN · ONSITE INTERVIEW · Seen Oct 2026

Similar questions at other companies

  • Merge Two Sorted ListsLinkedIn · PHONE SCREENLinkedIn interview questions
  • Middle of a Linked ListCisco · PHONE SCREENCisco interview questions
  • Merge Two Sorted ListsIBM · PHONE SCREENIBM interview questions
  • Count Nodes in a ChainApple · PHONE SCREENApple interview questions
  • Detect a Cycle in a Linked ListSalesforce · PHONE SCREENSalesforce interview questions
  • Find the Intersection Node of Two Linked ListsVisa · PHONE SCREENVisa interview questions
  • Reverse a Linked ListMygate · PHONE SCREENMygate interview questions
  • Linked List Palindrome in Constant SpaceNVIDIA · PHONE SCREENNVIDIA interview questions
  • First Node Two Linked Lists ShareAdobe · PHONE SCREENAdobe interview questions
  • Merge Two Sorted Linked ListsExpedia · PHONE SCREEN · ONSITE INTERVIEWExpedia interview questions

Bloomberg LP interview experiences

  • Bloomberg AI-Assisted Coding Round, All Levels: 14 Experiences
  • Bloomberg SWE Intern Interview Questions: 68 Questions
  • Bloomberg Interview Questions, Level Not Reported: 65 Questions
  • Bloomberg Experienced Design & More: 126 Questions (Part 2 of 2)
  • Bloomberg Experienced SWE Interviews: 167 Questions (Part 1 of 2)
  • Bloomberg New Grad Coding Questions: 121 Questions (Part 2 of 2)
All Bloomberg LP interview questionsSee Bloomberg LP hiring insights
Saved
class Solution {
    public int findIntersectionNode(int[] next, int headA, int headB) {
      // write your code here
    }
}
Checking account…