🥇 C++ || PYTHON  ||  EXPLAINED  |  ; ]
UPVOTE IF HELPFuuL\n\nAPPROACH\n\nLet the ball be in j column and i row., then at next row :\n If grid[i][j] == 1 , then ball will move to right column only if 
**UPVOTE IF HELPFuuL**\n\n**APPROACH**\n\n**Let the ball be in ```j``` column and ```i``` row.**, then at next row :\n* If ```grid[i][j] == 1``` , then ball will move to right column only if ```grid[i][j+1] == 1```. Otherwise it gets struck.\n* If ```grid[i][j] == -1``` , then ball will move to left column only if ```grid[i][j-1] == -1```. Otherwise it gets struck.\n\n***Here is a clear depiction where the ball will be at ```i``` ROW.***\n\n*For cases where the ball may reach ```0``` or ```n-1``` column, I have added two additional columns : one in front and other at back, so no extra check statements are required.* \n\n![image](https://assets.leetcode.com/users/images/dc40a194-b519-4574-83d4-68493a8d70bb_1657615037.2035635.png)\n\n\n\n\n**UPVOTE IF HELPFuuL**\n\n**C++**\n```\nclass Solution {\npublic:\n    vector<int> findBall(vector<vector<int>>& grid) {\n        vector<int>res;\n        int m = grid.size(), n = grid[0].size(), k= 0;\n        for (int j=0; j<n; j++){\n            k = j;\n            for (int i=0; i<m ;i++){\n                if ((k==0 && grid[i][k]==-1) || (k==n-1 && grid[i][k]==1)){\n                    k = -1000;\n                    break;\n                }\n                if (grid[i][k]==-1){\n                    if (grid[i][k-1]==-1) k--;\n                    else{\n                        k = -1000;\n                        break;\n                    }\n                }else{\n                    if (grid[i][k+1]==1) k++;\n                    else{\n                        k = -1000;\n                        break;\n                    }\n                }\n            }\n            if (k<0) res.push_back(-1);\n            else res.push_back(k);\n        }\n        return res;\n    }\n};\n```\n\n**PYTHON**\n```\nclass Solution:\n    def findBall(self, grid: List[List[int]]) -> List[int]:\n        \n        m,n=len(grid),len(grid[0])\n        for i in range(m):\n            grid[i].insert(0,1)\n            grid[i].append(-1)\n        res=[]\n        \n        for k in range(1,n+1):\n            i , j = 0 , k\n            struck = False\n            while i<m:\n                if grid[i][j]==1:\n                    if grid[i][j+1]==1:\n                        j+=1\n                    else:\n                        struck=True\n                        break\n                else:\n                    if grid[i][j-1]==-1:\n                        j-=1\n                    else:\n                        struck=True\n                        break\n                i+=1\n            if struck:\n                res.append(-1)\n            else:\n                res.append(j-1)\n                \n        return res\n```\n![image](https://assets.leetcode.com/users/images/b47eeb75-1993-45ef-a5ee-5fac9544ea02_1657615143.0559897.jpeg)\n
['Python']