November POTD Day 1 eazy understanding C++
```\nclass Solution {\npublic:\n    vector findBall(vector>& grid) {\n        \n        int r=grid.size();\n        int c=grid[0].size();\n        vector ans(c,
```\nclass Solution {\npublic:\n    vector<int> findBall(vector<vector<int>>& grid) {\n        \n        int r=grid.size();\n        int c=grid[0].size();\n        vector<int> ans(c,0);  //initiallizing a vector of size as column and value 0\n        for(int k=0;k<c;++k){       //loop for each ball starting from 0 -> c-1\n            int ball=k;\n            bool flag=0;\n            for(int i =0;i<r;++i){\n                \n                if((grid[i][ball]==1 && ball+1 == c)||(grid[i][ball]==1&&(grid[i][ball+1]==-1))||(grid[i][ball]==-1 && ball-1 ==-1)||(grid[i][ball]==-1 &&grid[i][ball-1]==1)){\n                    ans[k]=-1;\n                    flag=1;\n                    break;   // if its a dead end for the ball we need to terminate the loop\n                    \n                }else if(grid[i][ball]==1){\n\n                ball++;\n                }else{\n                    ball--;\n                }\n                \n            }\n            if(flag==1){    //if the flag is set to 1 that means the ball is set to a dead end we have already set the value of ans of ball\n                continue;\n            }else{\n            ans[k]=ball;\n            }\n        }\n        return ans;\n        \n    }\n};
['C']