Search
⌘K

Leetcode 2087. Minimum Cost Homecoming of a Robot in a Grid

Compute the minimum cost to move a robot from start to home on an m×n grid where entering row r costs rowCosts[r] and entering column c costs colCosts[c]. Because costs are nonnegative, an optimal path is monotonic, so the answer is the sum of rowCosts for rows between startRow and homeRow (excluding the start) plus the sum of colCosts for columns between startCol and homeCol (excluding the start).


Question Timeline

See when this question was last asked and where, including any notes left by other candidates.

Comments

Your account is free and you can post anonymously if you choose.