ques-https://leetcode.com/problems/flood-fill/
code-https://ide.codingblocks.com/s/277854
how to return the ans…using recursion
ques-https://leetcode.com/problems/flood-fill/
code-https://ide.codingblocks.com/s/277854
how to return the ans…using recursion
Create a different function and pass the values in it.
See this approach :-
ok the approach you shared is using dfs, can you share approch using recursion,which one is better
Both are same thing,if you implement it using recursion you will make recursion call same as you did in dfs.
The other approach is using bfs which gives iterative solution and is genrally considered better.