JS | Simple solution
var findBall = function(grid) {\n    let arr = [];\n    let colLength = grid.length;\n    let rowLength = grid[0].length ;\n    let tmpRow = 0\n    while(tmpRow
var findBall = function(grid) {\n    let arr = [];\n    let colLength = grid.length;\n    let rowLength = grid[0].length ;\n    let tmpRow = 0\n    while(tmpRow < rowLength){\n        let pos = tmpRow;\n        let tmpCol = 0;\n        while(tmpCol < colLength){\n            let check = checkCell(grid[tmpCol], pos);\n            if(check === 0){\n                pos = -1;\n                break;\n            }\n            pos += check;\n            tmpCol++;\n        }\n        arr.push(pos);\n        tmpRow++\n    }\n    return arr;\n};\n\nvar checkCell = function(row, index){\n    \n    if(row[index] === 1 && index+1 < row.length && row[index+1] === 1){\n        return 1\n    }\n     if(row[index] === -1 && index-1 >= 0 && row[index-1] === -1){\n        return -1\n    }\n    return 0\n}
['JavaScript']