Java Solution || Easy || Faster than 96.8% || 1ms runtime
```java \nclass Solution {\n    public int[] findBall(int[][] grid) {\n        int[] res = new int[grid[0].length];\n        for(int j=0;j<grid[0].length;j++)\n
```java \nclass Solution {\n    public int[] findBall(int[][] grid) {\n        int[] res = new int[grid[0].length];\n        for(int j=0;j<grid[0].length;j++)\n        {\n            res[j]=solve(grid,j);\n        }\n        return res;\n    }\n    \n    \n    private int solve(int[][] grid,int j)\n    {\n        for(int i=0;i<grid.length;i++)\n        {\n            if(j<grid[0].length-1 && grid[i][j]==1 && grid[i][j+1]==1){\n                j++;\n            } \n            else if(j>0 && grid[i][j]==-1 && grid[i][j-1]==-1){\n                j--;\n            }\n            else\n                return -1;\n        }\n        return j;\n    }\n}
['Iterator']