c++ || simple recursive function
```\nclass Solution {\npublic:\n    int solve(vector>& grid, int i , int j, int n , int m){\n        if(i>=n)\n            return j;\n        \n        if(grid[
```\nclass Solution {\npublic:\n    int solve(vector<vector<int>>& grid, int i , int j, int n , int m){\n        if(i>=n)\n            return j;\n        \n        if(grid[i][j]==1){\n            if(j==m-1 || grid[i][j+1]==-1)\n                return -1;\n           \n            if(grid[i][j+1]==1)\n                return solve(grid,i+1,j+1,n,m);\n        }\n        \n        if(grid[i][j]==-1){\n            if(j==0 || grid[i][j-1]==1)\n                return -1;\n            \n            if(grid[i][j-1]==-1)\n                return solve(grid,i+1,j-1,n,m);\n        }\n        \n        return -1;\n    }\n    vector<int> findBall(vector<vector<int>>& grid) {\n        int n=grid.size();\n        int m=grid[0].size();\n        \n        vector<int> ans;\n        \n        for(int i=0;i<m;i++){\n            int outColumn=solve(grid,0,i,n,m);\n            ans.push_back(outColumn);\n        }\n        \n        return ans;\n    }\n};\n
['Recursion', 'C']