Flood Fill Algorithm GFG question


this is my code when i submitted it give run time error

link for gfg question
https://practice.geeksforgeeks.org/problems/flood-fill-algorithm/0

hi @khemchandrs

instead of dynamic array use static array

Modified Code

this is because dynamic arrays are created on runtime and destroy once program finished

as you are not destroying the memory given in each testcase
that is why you are getting segmentation fault

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