About logic of code

sir, here in this code if I use set then, I am getting correct output but not with the min heap. why

hello @gargshivam2001

pls save ur code on cb ide and share its link with me, i want to check ur approach

@aman212yadav https://ide.codingblocks.com/s/476744

u need to push in queue ,only if it is not inserted before in heap.

make an additional visited array to keep track of all visited cells

@aman212yadav https://ide.codingblocks.com/s/476744 still not getting correct output

ss

when u inserting new cells then mark them visited as well