#3341
Find Minimum Time to Reach Last Room I
specialist · 815 · lc medium +31 · 55.5% accepted · 541 likes · top 49%
Description
A dungeon consists of n x m rooms arranged in a grid.
You are given a 2D array moveTime of size n x m, where moveTime[i][j] is the earliest time (in seconds) at which room (i, j) can be entered. You start at room (0, 0) at time t = 0. Each move to an adjacent room (sharing a wall horizontally or vertically) takes exactly one second.
Return the minimum time required to reach room (n - 1, m - 1).
Code
1
2
3