You are given an m x n integer grid H, where H[r][c] is the “difficulty/height” of cell (r,c).
(0,0)
and want to reach
(m-1, n-1)
.
the maximum
H[r][c]value encountered on that path (including start and end).
Return the minimum possible path cost (i.e., minimize the maximum cell value you ever step on).
Assumptions/constraints (typical interview constraints):
1 <= m,n <= 200
0 <= H[r][c] <= 10^9
You are given a weighted graph with n nodes labeled 1..n and a list of directed edges edges, where each edge is (u, v, w) meaning it takes time w > 0 to travel from u to v.
A signal starts at node k at time 0 and travels along edges.
dist[i]
be the shortest time for the signal to reach node
i
.
max(dist[i])
over all nodes
i
if every node is reachable, or
-1
if some node is unreachable.
Assumptions/constraints (typical interview constraints):
1 <= n <= 10^5
(or smaller in an interview)
1 <= |edges| <= 2*10^5
1 <= w <= 10^9
m=n=1
; Part 2:
n=1
).