← Airbnb Interview Insights

Airbnb·Software Engineer·Onsite - Coding / Algorithms·Intermediate

IntermediatePrefer not to say
Jun 2026

Summary

Airbnb coding round for a software engineer role. One problem, 45 minutes, and somehow they expect you to write code, build test cases from scratch, and handle a follow-up that's genuinely harder than the original. I came in strong on linked lists and still didn't finish.

Questions Asked (2)

Q1

Given two linked lists, each of which may or may not contain a cycle, determine whether they share at least one node.

Algorithms & Data Structures
Author's notes

My linked list fundamentals are solid so I got through the main logic fairly fast.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

First, detect cycles in both lists using Floyd's cycle-finding algorithm. Then, based on the presence of cycles, find the entry points and use two-pointer techniques to determine if the lists intersect.

Pro tip: Clarify with the interviewer whether the lists are singly linked and if modifying the lists is allowed; this shows attention to constraints and can simplify the solution.

1. Detect cycles

Use Floyd's tortoise and hare algorithm to determine if each list has a cycle. If a cycle is found, also find the entry point of the cycle.

2. Handle no-cycle cases

If neither list has a cycle, find the lengths of both lists, align the starting points, and traverse to check for a common node.

3. Handle one-cycle cases

If only one list has a cycle, they cannot intersect because a cycle would make the other list also have a cycle if they shared a node.

4. Handle both-cycle cases

If both have cycles, check if they share the same cycle entry point. If not, traverse the cycle of one list to see if the other's entry point is encountered.

5. Return result

Return true if a common node is found, otherwise false.

Key Points to Mention

  • Floyd's cycle detection algorithm (tortoise and hare)
  • Finding the cycle entry point
  • Length calculation and alignment for acyclic lists
  • Handling cases with one or both lists having cycles
  • Time complexity O(n+m) and space complexity O(1)
  • Edge cases: empty lists, single node, self-cycle

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.

Q2

Follow-up: modify your solution to return the actual intersecting node, not just whether one exists.

Algorithms & Data StructuresTechnical Trade-offs
Author's notes

This is where things fell apart.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

First, clarify the problem: are we dealing with two singly linked lists? If so, the goal is to find the node where they merge. Use a two-pointer technique: traverse both lists, and when one pointer reaches the end, redirect it to the head of the other list. If they intersect, the pointers will meet at the intersection node after at most two passes; if not, both will become null simultaneously.

Pro tip: Mention that this approach works in O(m+n) time and O(1) space, and that it elegantly handles lists of different lengths without explicitly computing their lengths. Also, note that if the lists might have cycles, you'd need to detect and handle that first.

1. Clarify the problem

Confirm that the input consists of two singly linked lists that may intersect, and that we need to return the intersecting node (or null if none). Ask if the lists can have cycles or if they are guaranteed acyclic.

2. Choose an approach

Decide between the two-pointer switching technique (O(1) space) or using a hash set to store visited nodes (O(n) space). For optimal space, prefer the two-pointer method.

3. Explain the two-pointer algorithm

Initialize two pointers at the heads of the lists. Traverse both simultaneously, advancing each pointer one step at a time. When a pointer reaches the end, redirect it to the other list's head. If the lists intersect, the pointers will meet at the intersection node; if not, they will both become null after at most m+n steps.

4. Analyze complexity and edge cases

State that time complexity is O(m+n) and space is O(1). Discuss edge cases: one or both lists empty, no intersection, intersection at the head, or lists of vastly different lengths.

5. Test with examples

Walk through a concrete example, such as list A: 1->2->3->4->5 and list B: 6->7->4->5, where the intersection is at node 4. Show how pointers move and meet.

Key Points to Mention

  • Two-pointer technique with pointer switching between lists
  • Time complexity O(m+n) and space complexity O(1)
  • Handling lists of different lengths without explicit length calculation
  • Edge cases: empty lists, no intersection, intersection at head
  • Alternative approach using a hash set (O(n) space) and trade-offs
  • If cycles are possible, detect and handle them first (e.g., using Floyd's algorithm)

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.