Expand the pond

help me!
what’s wrong with my code.

Hey @sutharp777
I have made changes to your code and added comments. Please check it out.

1 Like

bhiya can you create new link as this link not saved.

@sutharp777


There you go. Happy coding !!

1 Like

thank you bhiya :hugs:

1 Like

the value of m and n is 1000 is wort case it is not accept it shows TLE
can you back track it in recurion only

@sutharp777
Just keep a vector of pair. Push all points in it which have been visited in current movement and set them to 1.

I would like to point out one thing though. Your code currently has worst case N^2 complexity where N = n*m
You need to find a N complexity solution.

1 Like