[C++] Simple iterative solution (beginner)
\nclass Solution {\npublic:\n    vector<int> findBall(vector<vector<int>>& grid) {\n        vector<int> ret;\n        int r = grid.size();\n        int c = grid
```\nclass Solution {\npublic:\n    vector<int> findBall(vector<vector<int>>& grid) {\n        vector<int> ret;\n        int r = grid.size();\n        int c = grid[0].size();\n        for(int j=0; j<c; j++){\n            int x = 0;\n            int y = j;\n            while(1){\n                if(x==r){//if ball goes out of the box\n                    ret.push_back(y);\n                    break;\n                }\n                if(grid[x][y] == 1){\n                    if(y+1 == c || grid[x][y+1] == -1){//if ball goes outside the right wall/col-N or V pattern\n                        ret.push_back(-1);\n                        break;\n                    }\n                    x = x+1;\n                    y = y+1;\n                    continue;\n                }\n                else{//if ball goes outside the left wall/col-0 or V pattern\n                    if(y-1 < 0 || grid[x][y-1] == 1){\n                        ret.push_back(-1);\n                        break;\n                    }\n                    x = x+1;\n                    y = y-1;\n                    continue;\n                }\n            }\n        }\n        return ret;\n    }\n};\n```\n\nPlease feel free to suggest better solution/optimizations. Just a simple approach.
['C', 'Iterator']