C++ | Simple Simulation | O (m * n)
```\n    vector findBall(vector>& grid) {\n\t\t// Dimensions of the grid.\n        int m = grid.size();\n        int n = grid[0].size();\n\n        vector ans;\
```\n    vector<int> findBall(vector<vector<int>>& grid) {\n\t\t// Dimensions of the grid.\n        int m = grid.size();\n        int n = grid[0].size();\n\n        vector<int> ans;\n\t\t\n\t\t// Base case of only 1 column.\n        if (n == 1) {\n            ans.push_back(-1);\n            return ans;\n        }\n\t\t\n\t\t// Checking path of each ball and determining its next position.\n\t\t// Returing the final column value.\n        for (int i = 0; i < n; ++i)\n        {\n            bool flag = true;\n            int r = 0, c = i;\n            while (r < m) {\n                if (grid[r][c] == 1 && c < n - 1 && grid[r][c] == grid[r][c + 1]) c++;\n                else if (grid[r][c] == -1 && c > 0 && grid[r][c] == grid[r][c - 1]) c--;\n                else {\n                    ans.push_back(-1);\n                    flag = false;\n                    break;\n                }\n                r++;\n            }\n            if (flag) ans.push_back(c);\n        }\n        return ans;\n    }
['C++']