This question evaluates a candidate's competence in graph traversal and path-optimization concepts, emphasizing reasoning about path scores and handling grid-based constraints.
You are given an m x n integer matrix A. You start at the top-left cell (0,0) and want to reach the bottom-right cell (m-1,n-1) by moving only in 4 directions (up/down/left/right).
For any path, define its score as the minimum value among all cells on that path.
Task: Return the maximum possible path score.
A
:
m x n
matrix of integers
1 <= m, n <= 300
-10^9 <= A[i][j] <= 10^9
Input:
5 4 5
1 2 6
7 4 6
Output:
4
Explanation: One optimal path has minimum cell value 4, and no path can achieve a minimum > 4.