Comment on page

# 1102.Path-With-Maximum-Minimum-Value

## 题目描述

Given a matrix of integers A with R rows and C columns, find the maximum score of a path starting at [0,0] and ending at [R-1,C-1].
The score of a path is the minimum value in that path. For example, the value of the path 8 → 4 → 5 → 9 is 4.
A path moves some number of times from one visited cell to any neighbouring unvisited cell in one of the 4 cardinal directions (north, east, west, south).

## 代码

### Approach #1 Priority BFS Greedy

class Solution {
int [][] dirs = {{0, -1}, {0, 1}, {-1, 0}, {1, 0}};
public int maximumMinimumPath(int[][] A) {
int m = A.length;
int n = A.length;
PriorityQueue<int[]> maxHeap = new PriorityQueue<int[]>((a, b) -> b - a);
boolean [][] visited = new boolean[m][n];
visited = true;
int res = A;
while (!maxHeap.isEmpty()) {
int[] cur = maxHeap.poll();
res = Math.min(res, cur);
if (cur == m - 1 && cur == n - 1) {
return res;
}
for (int [] dir : dirs) {
int x = cur + dir;
int y = cur + dir;
if (x < 0 || x >= m || y < 0 || y >= n || visited[x][y]) {
continue;
}
visited[x][y] = true;