⛄🚀 C++ BEGINEER FRIENDLY 😍 || SIMPLE MATH || EASIEST APPROACH ✔  +   EXPLANATION ✨💯 ||  FAST  🔥
Intuition & Aproach : \n\nHope you guys doing great. Thanks for giving me love on my answer posting \u2764, this boost me everyday to come up with easiest appro
# Intuition & Aproach : \n\nHope you guys doing great. Thanks for giving me love on my answer posting \u2764, this boost me everyday to come up with easiest approach for you guys \uD83D\uDE09.\n\nLets hop to todays problem. \nwe have given a vector of string or if we imagine then 2D matrix type in whixh each row have `0` or `1` . `1` represent the` beam point`. and that beam point will connect to other nearest row `beam point` to form a `laser beam`. so we have to find how many `laser beam `we can form.\n\nHope by above you definately got a image how to do this question.\nyesss , you are right \u2714\uD83D\uDE09 .Lets see step wise:\n\n1. if there are `n `beam in 1st row and `m` beam in 2nd row. laser form will be = `m*n`.\n2. so we can create a `array of int` to save total beam in a row. so number of rows will be size of our array.\n3. and if a row have `0` beam so we will go to next row.\n4. hence this way in our` new array` of we will only have value greater than 0 , so that we can make beam pairs with the `i and i+1 ` beams.\n5. For better visual lets see solution below :-\n\n# Code\n```\nclass Solution {\npublic:\n    int numberOfBeams(vector<string>& bank) {\n        int n=bank.size();\n        if(n<2) return 0;\n        vector<int>ans;\n\n        //pushing total sum of row from 2D vector to  new 1D `ans` vector\n        for(int i=0;i<n;i++){\n            int sum=0;\n            for(auto j: bank[i]){\n                if(j==\'1\') sum++;\n            }\n            if(sum>0)  ans.push_back(sum);\n        }\n\n        if(ans.size()<2) return 0;\n        int laser=0;\n        \n        //total possible beams can be formed in two adjacent rows\n        for(int i=0;i<ans.size()-1;i++){\n            laser = laser+ (ans[i]*ans[i+1]);\n        }\n     return laser;\n    }\n};\n```\n\n# please UPVOTE.... Your appreciation \u2B06 fuels my enthusiasm to keep sharing solutions. \uD83D\uDE80 \uD83D\uDE0A\u26C4\u2744 \u2764
['Array', 'Math', 'String', 'Matrix', 'C++']