MLE in result ,in o(n*m) space


#1

My solution is giving mle. in o(n*m) space. getting partial points
?


#2

Try using bool for marking the visited coordinates…


#3

try using map for storing visited coordinates


#4

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


#5

thanks man! was stuck. The reason makes sense!