Problem 3603 · Medium

Minimum Cost Path with Alternating Directions II

Walk an m by n grid from the top-left cell to the bottom-right cell using right and down moves. Entering cell (i, j) costs (i + 1) * (j + 1), and every cell you leave after the first charges its waitCost, so find the cheapest total.

Open the interactive visualisation