← Expedia Interview Insights

Expedia·Software Engineer·Technical Phone Screen·Intermediate

Intermediate
Jun 2026

Summary

Coding round at Expedia for a software engineer role. Pretty standard DP problem, nothing too wild, but the space optimization part is where they seemed to care most.

Questions Asked (1)

Q1

You have a row of houses each with some amount of money. You can't rob two houses next to each other or the alarm goes off. What's the maximum you can steal?

Algorithms & Data Structures
Author's notes

Classic house robber problem.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying the problem and edge cases, then explain that this is a classic dynamic programming problem where you decide to rob or skip each house based on the maximum of the previous two states. Walk through a simple example, derive the recurrence relation, and implement an efficient solution with O(n) time and O(1) space.

Pro tip: After presenting the optimal solution, mention that this problem is equivalent to finding the maximum sum of non-adjacent elements, and briefly discuss how you would handle variations like a circular street or negative values to show depth.

1. Clarify and Restate

Confirm that houses are in a line, each has a non-negative amount, and you cannot rob adjacent houses. Ask about edge cases like empty input or single house.

2. Define Subproblem and Recurrence

Let dp[i] be the maximum amount robbable from the first i houses. Then dp[i] = max(dp[i-1], dp[i-2] + money[i-1]).

3. Walk Through Example

Use a small example like [2,7,9,3,1] to demonstrate how the recurrence builds up the solution step by step.

4. Optimize Space

Observe that only the last two dp values are needed, so reduce space complexity from O(n) to O(1) by keeping two variables.

5. Implement and Test

Write clean code, handle edge cases, and test with the example and additional cases like all zeros or alternating high values.

Key Points to Mention

  • Dynamic programming approach with optimal substructure
  • Recurrence relation: dp[i] = max(dp[i-1], dp[i-2] + nums[i])
  • Time complexity O(n) and space complexity O(1) after optimization
  • Handling edge cases: empty array, single house, two houses
  • Comparison with brute-force or recursive solutions and why DP is better
  • Potential follow-up: circular arrangement (House Robber II) or other variations

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