Cheapest Mix of Day, Week and Month Airport Parking Passes

Last updated: November 29, 2026

Quick Overview

A traveler booking through Capital One Travel needs airport parking on a sorted list of days. Passes cover 1, 7 or 30 consecutive days at given prices; return the minimum total cost to cover every listed day.

Capital One
Coding & Algorithms
Software Engineer
Capital One
November 29, 2026
Software Engineer
Technical Screen
Coding & Algorithms
Medium

0

0

0 solved


A traveler booking through Capital One Travel needs airport parking on a sorted list of days. Passes cover 1, 7 or 30 consecutive days at given prices; return the minimum total cost to cover every listed day.

Capital One Travel and the Venture card family make travel-cost optimization a natural framing for a dynamic programming screen. The interviewer is checking that you define the state precisely, avoid the greedy trap of always buying the cheapest per-day pass, and iterate only over travel days rather than every calendar day.

What the Interviewer Expects
  • Define dp over travel-day indices, not all calendar days
  • Show why greedy choices fail on a concrete example
  • Compute the next uncovered travel day efficiently
  • Return 0 for an empty schedule
  • State time and space complexity
Key Topics to Cover
1D dynamic programming
Suffix DP
Two pointers
Greedy counterexamples
How to Approach This
  1. Clarify input constraints and edge cases before writing code.
  2. Walk through your approach verbally and confirm with the interviewer before coding.
  3. Start with a brute force solution, then optimize. Mention time and space complexity.
  4. Test your solution with examples, including edge cases like empty input or duplicates.
  5. Consider common patterns: sliding window, two pointers, hash map, BFS/DFS, dynamic programming.
Possible Follow-up Questions
  • How would you also return which passes to buy and on which days?
  • What if a pass can start on any day, including days you are not traveling?
  • How does the solution change if there are dozens of pass types with arbitrary lengths?
  • If prices change by season, what extra state do you need?
Sharpen Your Skills on Codemia

Practice similar problems with our interactive workspace, get AI feedback, and track your progress.

Practice DSA Problems
Sample Answer
Requirements
  • days: sorted, distinct positive integers. prices: costs aligned with durations = (1, 7, 30), durations sorted ascending.
  • A pass bought on day d covers d through d + length - 1.
  • Return the ...
High-Level Design

Let dp[i] be the cheapest way to cover days[i:]. For each pass type, buying it on days[i] covers everything before days[i] + length, so the next state is the first index j with `days[j] >= day...


Submit Your Answer
Markdown supported