Python 3 | DFS, Simulation | Explanation
Explanation\n- Simulate the process\n\t- When current board is 1 (right), ball will move to right only if the right neighbor of current position is also 1\n\t- 
### Explanation\n- Simulate the process\n\t- When current board is 1 (right), ball will move to right only if the right neighbor of current position is also 1\n\t- When current board is -1 (left), ball will move to left only if the left neighbor of current position is also -1\n- Repeat above process until the ball drop to bottom or return -1 if it won\'t\n- DFS is not necessary, you can implement it using an iterative way instead\n- Time: `O(m*n)`\n### Implementation\n```\nclass Solution:\n    def findBall(self, grid: List[List[int]]) -> List[int]:\n        m, n = len(grid), len(grid[0])\n        @cache\n        def helper(r, c):\n            if r == m:\n                return c\n            elif grid[r][c] == 1 and c+1 < n and grid[r][c+1] == 1:\n                return helper(r+1, c+1)\n            elif grid[r][c] == -1 and 0 <= c-1 and grid[r][c-1] == -1:\n                return helper(r+1, c-1)\n            else:\n                return -1\n            \n        return [helper(0, j) for j in range(n)]\n```
['Depth-First Search', 'Simulation', 'Python', 'Python3']