[Javascript] Easy to understand solution
javascript\nvar findBall = function(grid) {\n    let balls = grid[0].length;\n    const ans = new Array(balls).fill(-1);\n    for (let i = 0; i < ans.length; i+
```javascript\nvar findBall = function(grid) {\n    let balls = grid[0].length;\n    const ans = new Array(balls).fill(-1);\n    for (let i = 0; i < ans.length; i++) {\n        ans[i] = dfs(grid, 0, i);\n    }\n    return ans;\n};\n\nvar dfs = function(grid, r, c) {\n    // is stuck in a V\n    if (\n        grid[r][c] === 1 && grid[r][c+1] === -1 ||\n        grid[r][c] === -1 && grid[r][c-1] === 1\n    ) {\n        return -1;\n    }\n    \n    // is stuck on left wall\n    if (grid[r][c] === -1 && c - 1 < 0) {\n        return -1;\n    }\n    // is stuck on right wall\n    if (grid[r][c] === 1 && c + 1 >= grid[0].length) {\n        return -1;\n    }\n    \n    // when ball drops to bottom :)\n    if (r === grid.length - 1) {\n        // drops to right\n        if (grid[r][c] === 1) return c + 1;\n        // drops to left\n        return c - 1;\n    }\n    \n    // dfs right\n    if (grid[r][c] === 1) {\n        return dfs(grid, r + 1, c + 1);\n    }\n    //  dfs left\n    return dfs(grid, r + 1, c - 1);\n}\n```
['Depth-First Search', 'Recursion', 'JavaScript']