Back to problems

Solve Linked-List and Iterator Problems

Algorithm · Airbnb · Hard

Problem 1 Given the heads of two singly linked lists headA and headB, each of which may contain at most one cycle. A ListNode is considered shared if it is reachable by following next pointers from both heads. Return the first shared node encountered when traversing from headA. If the lists have no shared node, return null. The lists must not be modified. In the examples, equal node values represent the same ListNode object when they appear in both lists. A tail may point to…

Checking your access…