← DoorDash Interview Insights

DoorDash·Software Engineer·Technical Phone Screen·Intermediate

Intermediate
Apr 2026

Summary

DoorDash data engineering screen, one coding question, sliding window stuff. Not a bad experience but the index conversion tripped me up more than I'd like to admit.

Questions Asked (1)

Q1

Given an array of daily revenue values and a window size k, find the contiguous k-day period with the maximum sum and return its start day as a 1-based index. Ties should return the earliest start day. The result should be wrapped in a list.

Algorithms & Data Structures
Author's notes

I knew sliding window immediately, got the O(n) logic down pretty fast.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Use a sliding window of size k to compute the sum of each contiguous k-day period in O(n) time. Track the maximum sum and the earliest starting index (1-based) that achieves it. Return the result as a list containing that index.

Pro tip: Mention that you handle edge cases like k > array length or empty array, and clarify that ties are broken by choosing the earliest start day. Also, note that the result should be wrapped in a list as specified.

1. Understand the problem and constraints

Restate the problem: find the contiguous k-day period with the maximum sum, return the 1-based start day as a list, and break ties by earliest start. Ask clarifying questions about input size, possible negative values, and edge cases.

2. Choose the sliding window approach

Explain that a sliding window of size k allows computing each window sum in O(1) by adding the new element and subtracting the old one, achieving O(n) time and O(1) extra space.

3. Initialize and iterate

Compute the sum of the first k elements, set it as the current maximum, and record start index 1. Then slide the window from index k to n-1, updating the sum and checking if the new sum exceeds the current maximum (strictly greater to keep earliest tie).

4. Handle edge cases and return

If k > n or n == 0, return an empty list or handle as appropriate. After the loop, return [best_start] where best_start is the 1-based index of the maximum sum window.

Key Points to Mention

  • Sliding window technique for O(n) time complexity
  • 1-based indexing for the start day
  • Tie-breaking: choose the earliest start day (use strict greater-than comparison)
  • Return type: wrap the result in a list
  • Edge cases: k > array length, empty array, negative values
  • Space complexity: O(1) extra space

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