Practice Minimum Cost Path with Alternating Directions II
Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.
Minimum Cost Path with Alternating Directions II
Problem Statement
In an m by n grid, entering (i, j) costs (i + 1) * (j + 1). Start at (0, 0) at second 1 and pay its entry cost. At odd seconds, move right or down and pay the destination’s entry cost. At even seconds, wait and pay waitCost for the current cell. Stop immediately upon reaching the bottom-right cell, without another wait. Return the minimum total cost.
Source: Minimum Cost Path with Alternating Directions II on LeetCode. Use the original task for its coding environment and submissions.
Examples
# Example 1
m = 1, n = 2, waitCost = [[1,2]]
3
# Example 2
m = 2, n = 2, waitCost = [[3,5],[2,4]]
9
# Example 3
m = 2, n = 3, waitCost = [[6,1,4],[3,2,5]]
16
Constraints
Related LeetCode Problems
Practice more problems similar to Minimum Cost Path with Alternating Directions II.
Review your practice with PhantomCodeAI
After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.