← Expedia Interview Insights

Expedia·Software Engineer·Technical Phone Screen·Intermediate

Intermediate
May 2026

Summary

Expedia software engineer interview with a coding problem that looked deceptively simple but had a subtle constraint I almost missed. The digit range for wildcards isn't 0-9, it's 0-8, which changes things a bit if you're not paying attention.

Questions Asked (1)

Q1

Given a string of digits and '?' wildcards (e.g. '08??840') and a target sum, replace each '?' with a digit from 0 to 8 (not 0 to 9) and return all strings whose digits sum to the target.

Algorithms & Data Structures
Author's notes

I started writing a brute-force combination generator before I even clocked the 0-8 range thing.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Use backtracking to replace each '?' with digits 0-8, pruning branches where the partial sum plus the minimum possible sum of remaining digits exceeds the target or plus the maximum possible sum is less than the target. Collect all valid strings where the total sum equals the target. This approach efficiently explores only feasible combinations.

Pro tip: Clarify upfront that '?' can be replaced by digits 0-8 (not 0-9) and that the target sum applies to all digits including fixed ones. Also discuss handling edge cases like no solution or empty string.

1. Clarify requirements and constraints

Confirm the range for '?' (0-8), that fixed digits are included in the sum, and ask about output format (list of strings, order, duplicates).

2. Precompute fixed sum and count wildcards

Calculate the sum of fixed digits and count the number of '?' to determine the remaining sum needed and the number of digits to assign.

3. Design backtracking with pruning

Recursively assign digits 0-8 to each '?', tracking the current sum. Prune if current sum + min possible remaining > target or current sum + max possible remaining < target.

4. Implement and test

Write the recursive function, ensuring base case when all '?' are replaced and sum equals target. Test with examples and edge cases.

5. Analyze complexity and optimize

Discuss time complexity (worst-case 9^k where k is number of '?') and how pruning reduces it. Mention potential optimizations like memoization if needed.

Key Points to Mention

  • Backtracking with pruning based on min/max possible sums
  • Time complexity: O(9^k) worst-case, but pruning improves average case
  • Space complexity: O(k) for recursion stack plus output storage
  • Handling edge cases: no solution, empty string, target sum impossible
  • Clarifying the digit range for '?' (0-8) and inclusion of fixed digits
  • Potential optimization: dynamic programming or meet-in-the-middle for large k

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