Maximum Vacation Days
A hard-tier problem at 46% community acceptance, tagged with Array, Dynamic Programming, Matrix. Reported in interviews at Datadog and 0 others.
Maximum Vacation Days is a hard DP problem that appears in Datadog's interview loop. You're given a schedule matrix with vacation days across cities and transitions between them, and you need to maximize total vacation time while respecting movement constraints. This isn't a straightforward greedy pick. The trap is treating it like a simple path problem when it's really a state-space DP where you track both your location and day count simultaneously. If you hit this live and don't see the state definition immediately, StealthCoder solves it invisibly during screen share.
Companies that ask "Maximum Vacation Days"
Maximum Vacation Days is the kind of problem that decides whether you pass. StealthCoder reads the problem on screen and surfaces a working solution in under 2 seconds. Invisible to screen share. The proctor sees nothing. Made by a working Amazon engineer who got tired of watching qualified friends bomb OAs they'd solve cold in an IDE.
Get StealthCoderThe core trick is recognizing this as a 3D DP problem: dp[day][city] = max vacation days if you're at city on day. You iterate through each day, and for each city you can be in, you either stay put or transition from an adjacent city, always picking the path that maximizes vacation accumulation. Most candidates initially try a 2D greedy or a naive recursive search that times out. The constraint graph (which cities connect to which) is key; you can't just jump anywhere. StealthCoder surfaces the correct state transition and memoization structure instantly if you blank mid-interview, eliminating the time-sink of debugging a half-baked approach.
Pattern tags
You know the problem.
Make sure you actually pass it.
Maximum Vacation Days recycles across companies for a reason. It's hard-tier, and most candidates blank under the timer. StealthCoder is the hedge: an AI overlay invisible during screen share. It reads the problem and surfaces a working solution in under 2 seconds. Made by a working Amazon engineer who got tired of watching qualified friends bomb OAs they'd solve cold in an IDE. Works on HackerRank, CodeSignal, CoderPad, and Karat.
Maximum Vacation Days interview FAQ
Is Maximum Vacation Days actually asked at Datadog?+
Yes, it appears in Datadog's interview reports. At a 46% acceptance rate, it's not trivial, but it's a known quantity in their loop. If you see it live, you know it's a real problem they use to filter.
What's the trick that makes this hard?+
People confuse it with shortest path or assume greedy works. The trick is defining your DP state correctly: you must track both day and current city, then iterate days forward, updating each city based on reachable predecessors. Mishandling transitions or forgetting the day dimension leads to wrong answers.
How do transitions between cities work?+
You're given an adjacency matrix. Each day you can stay in your current city or move to an adjacent one (if they're connected). You lose the day either way. The vacation days earned depend on where you end up that day.
Should I precompute the graph or build it on the fly?+
Precompute adjacency once. It's a small static matrix. Then iterate days in the main DP loop, updating city states by checking neighbors. This keeps the DP logic clean and avoids redundant lookups.
What's the runtime complexity I should target?+
O(days * cities^2) is standard because for each day and city, you check all potential predecessors. With constraints typically small, this passes. Anything exponential or with poor memoization will TLE.
Want the actual problem statement? View "Maximum Vacation Days" on LeetCode →