Back to problems

Minimum-Cost Path on a Grid with Fuel and Recharge Cells

Algorithm · ByteDance · Hard

Requirements You receive an m x n board, three aligned arrays, and a fuel limit: grid_cost[i][j] is the charge incurred upon entering position (i, j), with the initial position included. blocked[i][j] indicates whether position (i, j) is unavailable when it is True. recharge[i][j] indicates that entering this position restores fuel to K when it is True. K is the tank's fuel capacity. Begin at (0, 0) with a tank containing K units and pay the cost of that starting cell. Your…

Checking your access…