What is wrong with my code flodd fill?

use this approach this is correct one

i hope this helps
if yes hit a like and don’t forgot to mark doubt as resolved :grinning:
if you have more doubts regarding this feel free to ask

i actually wanted a top down approach …can i get it ? and i wanted to know the error in my code i followed everything how it is explained in the hint video

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.

i actually wanted a top down approach …can i get it ? and i wanted to know the error in my code i followed everything how it is explained in the hint video

So the issue with your code is the value of n. You are continuing with the value of the original array. You need to update it according to the size of freq.