dp of size n x n with all values set to n.mines array and set dp[xi][yi] to 0 for each mine location (xi, yi).(r, c) in the grid, calculate the maximum arm length in each direction:
r to 0 and update dp[r][c] with the minimum value encountered.r to n-1 and update dp[r][c] similarly.c to 0 and update dp[r][c] similarly.c to n-1 and update dp[r][c] similarly.dp[r][c] after these iterations will be the order of the largest plus sign centered at (r, c).dp array, which is the final answer.