← DoorDash Interview Insights

DoorDash·Software Engineer·Technical Phone Screen·Intermediate

Intermediate
Jun 2026

Summary

DoorDash data engineer screen with a classic pairing problem. Nothing too wild but the index-based output tripped me up a bit.

Questions Asked (1)

Q1

Given an array of task durations in minutes, find all pairs of tasks whose combined duration equals exactly 60 minutes, and return their index pairs. For example, given [1, 43, 20, 59, 30, 30], the answer would be [[0, 3], [4, 5]].

Algorithms & Data Structures
Author's notes

My first instinct was a brute force double loop and I almost just went with it.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Use a hash map to store each task's duration and its index as you iterate through the array. For each task, check if its complement (60 - duration) exists in the map; if so, record the index pair. This yields O(n) time and O(n) space.

Pro tip: Clarify whether each task can be used in multiple pairs or if pairs should be unique, and whether the output order matters. Also, mention that you'd handle duplicates carefully by storing a list of indices for each duration.

1. Clarify requirements

Ask about edge cases: can a task be paired with itself? Should pairs be unique? What if multiple tasks have the same duration? Does the order of pairs matter?

2. Choose data structure

Select a hash map (dictionary) to map duration to a list of indices, enabling O(1) complement lookups.

3. Iterate and find pairs

Traverse the array; for each task, compute its complement and check if it exists in the map. If yes, form pairs with all stored indices (avoiding self-pairing) and add to results. Then add the current index to the map.

4. Handle duplicates and edge cases

Ensure that when the complement equals the current duration, you only pair with previously seen indices to avoid duplicates and self-pairing.

5. Analyze complexity and test

State time complexity O(n) and space O(n). Walk through the example and test edge cases like empty array, no pairs, and multiple pairs.

Key Points to Mention

  • Hash map for O(1) lookups to achieve linear time complexity
  • Handling duplicate durations by storing lists of indices
  • Avoiding self-pairing when complement equals current duration
  • Time and space complexity analysis (O(n) time, O(n) space)
  • Edge cases: empty array, no pairs, all elements same, negative numbers?
  • Clarifying output format and ordering with the interviewer

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