Simple & Easy to Understand | C++
Approach\n Describe your approach to solving the problem. \nIf block is directing ball to right and the immediate right is directing to left => V shape formed .
# Approach\n<!-- Describe your approach to solving the problem. -->\nIf block is directing ball to right and the immediate right is directing to left => V shape formed .Same if block is directing to left and immediate left has right(1) => V formed. Also if we encounter a wall on any side , ball  will get stuck there.\n\n---\n\n\n# Complexity\n- Time complexity: O(m*n)\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n---\n\n\n- Space complexity: O(1) (ignoring space for ans vector)\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n---\n\n\n# Code\n```\nvector<int> findBall(vector<vector<int>>& vec) {\n        vector<int> res ;\n        for(int i =0;i<vec[0].size();i++){\n\n            int  x=0,y=i;\n            bool flag = true;\n            while(x<vec.size()){\n\n                if(vec[x][y]==1){   // if block is directing ball to right\n                 if (y+1>= vec[0].size() || vec[x][y+1]!=1){ // ball will go down only if immediate right directs right otherwise V shape formed\n                   flag = false;\n                   break;       }\n                 x++,y++;\n                }\n\n                else if(vec[x][y]==-1){  // if block is directing to left\n                      if (y-1<0 || vec[x][y-1]!=-1){\n                   flag = false;\n                   break;       }\n                 x++,y--;\n                }\n\n            }\n            if(flag)res.push_back(y);\n            else\n                res.push_back(-1);\n\n        }\n           return res;\n\n    }\n```
['C++']