[Java]Simulate, straightforward and easy to understand
idea\nfor each ball in column i, we check if it can fall into next row until the end, the condition is clear, if current cell is 1, we check its right cell, if 
***idea***\nfor each ball in column i, we check if it can fall into next row until the end, the condition is clear, if current cell is 1, we check its right cell, if it\'s in opposite direction or wall(boundary), it stucked, otherwise, ball move to next row, and its right column, similarly, if current cell is -1, we check its left cell. till the end, we have the current column index of the ball, add it to res.\n***Time and Space***\ntime is O(mn), where m is row, n is col, as each ball would go through all rows to fall into bottom\nspace is O(1) if we dont consider res as space cost\n```\nclass Solution {\n    int m;\n    int n;\n    public int[] findBall(int[][] grid) {\n        m = grid.length;\n        n = grid[0].length;\n        int[] res = new int[n];\n        for(int i=0;i<n;i++){\n            res[i] = helper(grid,i,0);\n        }\n        return res;\n    }\n    \n    int helper(int[][] grid,int col,int row){\n        while(row<m){\n            int num = grid[row][col];\n            if(col+num<0 || col+num>=n || num!=grid[row][col+num])\n                return -1;\n            row++;\n            col = col+num;\n        }\n        return col;\n    }\n}\n```
[]