Simple C++ DFS
\nclass Solution {\npublic:\n         vector<int> findBall(vector<vector<int>>& grid) \n        {    \n        int row = grid.size(), col = grid[0].size();\n   
```\nclass Solution {\npublic:\n         vector<int> findBall(vector<vector<int>>& grid) \n        {    \n        int row = grid.size(), col = grid[0].size();\n        vector<int>result;\n\t\tfor(int i = 0;i<col;i++)\n\t\tresult[i] = -1;\n        \n        if(row == 1 and col == 1)\n            return result;\n        \n        for(int i = 0; i<col; i++)\n        {\n            int r = 0, c = i;\n            \n            while(r>=0 and c>=0 and r<row and c<col)\n            {\n                if(grid[r][c] == 1)\n                {\n                    if(c+1<col and grid[r][c+1] == -1)\n                        break;\n                    \n                    c++;\n                }\n                else\n                {\n                    if(c-1>=0 and grid[r][c-1] == 1)\n                            break;\n                    \n                    c--;\n                }\n                \n                r++;\n            }\n            \n            if(r == row)\n               result[i] = c;\n        }\n        \n        return result;   \n    }\n    \n};\n```
[]