Expedia onsite coding, the ? digits backtracking question
Expedia onsite coding, the ? digits backtracking question
Did the Expedia VO recently, 3 rounds. Writing up the coding round since I couldn't find much on it beforehand.
All 3 of my rounds opened with a quick values question (this one was about owning a mistake), maybe 5 min, then straight into code.
You get a string of digits mixed with ? characters, plus a target sum and a max value. Every ? has to become a single digit between 0 and that max, and you return every filled in string whose digits add up to the target. Fixed digits stay as they are even if they're bigger than the max. So something like 4??1 with target 9 and max 3 only gives you three strings back, since the two blanks need to make 4 and neither can go over 3.
Went with plain DFS over the ? positions. Subtracted the fixed digits from the target up front, then pruned whenever the remaining sum went negative or got bigger than max times the blanks left.
Follow ups were talk only, no code. Started with what changes if you just need one valid string (return on the first hit). Then whether the order you fill blanks in matters for pruning, kinda fumbled that one tbh. Oh and no leading zeros, which is basically restricting what the first slot can be.
SD was a disaster notification thing for rental properties, BQ was the accountability one. No word yet.
Replies (0)
No replies yet — start the conversation!