My solution is giving mle. in o(n*m) space. getting partial points
?
MLE in result ,in o(n*m) space
mark visited[i][j] just after pushing into queue to avoid MLE. If not you would push same (i,j) pair many times into queue in bfs and it causes MLE
mark visited[i][j] just after pushing into queue to avoid MLE. If not you would push same (i,j) pair many times into queue in bfs and it causes MLE