Skip to content

983. Minimum Cost For Tickets #1038

Answered by mah-shamim
mah-shamim asked this question in Q&A
Discussion options

You must be logged in to vote

The problem involves determining the minimum cost to travel on a set of specified days throughout the year. The problem offers three types of travel passes: 1-day, 7-day, and 30-day passes, each with specific costs. The goal is to find the cheapest way to cover all travel days using these passes. The task requires using dynamic programming to efficiently calculate the minimal cost.

Key Points

  • Dynamic Programming (DP): We are using dynamic programming to keep track of the minimum cost for each day.
  • Travel Days: The travel days are provided in strictly increasing order, meaning we know exactly which days we need to travel.
  • Three Types of Passes: For each day d in the days array, calculate …

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@topugit
Comment options

topugit Dec 31, 2024
Collaborator

@mah-shamim
Comment options

mah-shamim Dec 31, 2024
Maintainer Author

Answer selected by topugit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
question Further information is requested medium Difficulty
2 participants