Your question is Shortest Path in Cost Maze. Start with the requirements on the right.
Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.
Given a 2D grid maze of non-negative integers, find the minimum total cost to move from the top-left cell (0, 0) to the bottom-right cell (m-1, n-1). You may move up, down, left, or right. Entering a cell adds that cell’s cost to the path total, including the starting and ending cells. Return -1 if the destination cannot be reached.
def min_cost_maze_path(maze):