Ezvor

2361. Minimum Costs Using the Train Line

HardArray Preparing judge… LeetCode
ArrayDynamic Programming

Hints

Hint 1
Notice and evaluate the different ways there are to move from one stop to the next.
Hint 2
From the express route at a previous stop, we can use either the express route or the regular route to the next stop without paying expressCost.
Hint 3
From the regular route at a previous stop, we can either use the express route after paying expressCost or use the regular route without paying expressCost.
Hint 4
Iterate through the stops and compare the above cases to obtain the minimum costs for each stop.