Https://leetcode.com/problems/flood-fill/

this ques is same actually , but same logic is not working here , can you please check this code

class Solution { public int[][] floodFill(int[][] image, int sr, int sc, int newColor) helper(image,sr,sc,newColor, image[sr][sc]); return image; } public static void helper(int[][] image, int i, int j, int color,int startColor){ if(i<0 || j<0 || i>=image.length || j>=image[0].length){ return; } if(image[i][j]==color || image[i][j]!=startColor){ return; } image[i][j]=color; int[] x={0,0,1,-1}; int[] y={1,-1,0,0}; for(int k=0;k<4;k++){ helper(image,i+x[k],j+y[k],color,startColor); } } }

you can paste my code as it is

@Muskan-Gupta-598128740703036 Can you please paste the code on coding blocks IDE and then send me the link, it would save both of our time