Java DP solution beats 100% (Self Documented Code)
\n\nclass Solution {\n    public int[] findBall(int[][] grid) {\n        int landedSpots[] = new int[grid[0].length];\n        Arrays.fill(landedSpots, -1);\n  
\n```\nclass Solution {\n    public int[] findBall(int[][] grid) {\n        int landedSpots[] = new int[grid[0].length];\n        Arrays.fill(landedSpots, -1);\n        \n        for (int column = 0; column < grid[0].length; column++) {\n            int columnLandedIn = ballFall(grid, 0, column);\n            \n            if (columnLandedIn != -1) landedSpots[column] = columnLandedIn;\n        }\n        return landedSpots;\n    }\n    \n    public int ballFall(int[][] grid, int row, int column) {\n        if (row == grid.length) return column;\n        \n        int cellDirection = grid[row][column];\n        int directionCellColumn = column+cellDirection;\n        \n        if (directionCellColumn < 0 || directionCellColumn > grid[row].length - 1) return -1;\n        if (grid[row][directionCellColumn] != cellDirection) return -1;\n        \n        return ballFall(grid, row + 1, directionCellColumn);\n    }\n}\n```\n![image](https://assets.leetcode.com/users/images/11354832-e00c-4c76-b85f-17a911d7a94c_1663762573.6559026.png)
['Dynamic Programming', 'Java']