Golang | DFS
\nfunc findBall(grid [][]int) []int {\n    m, n := len(grid), len(grid[0])\n    output := make([]int, n)\n    \n    for i := 0; i < n; i++ {\n        output[i] 
```\nfunc findBall(grid [][]int) []int {\n    m, n := len(grid), len(grid[0])\n    output := make([]int, n)\n    \n    for i := 0; i < n; i++ {\n        output[i] = -1\n        r, c := 0, i\n        \n        for r < m {\n            if grid[r][c] == 1 && c+1 < n && grid[r][c+1] != -1 {\n                r++\n                c++\n            } else if grid[r][c] == -1 && c-1 >= 0 && grid[r][c-1] != 1 {\n                r++\n                c--\n            } else {\n                break\n            }\n        }\n        \n        if r == m {\n            output[i] = c\n        }\n    }\n    return output\n}\n```
['Go']