Easy C++ Solution with video Explanation
Video Explanation\nhttps://youtu.be/P9YW8n1GrlI?si=pAfMnzN4w9D7aL7d\n\n# Complexity\n- Time complexity: O(n) \n Add your time complexity here, e.g. O(n) \n\n- S
# Video Explanation\nhttps://youtu.be/P9YW8n1GrlI?si=pAfMnzN4w9D7aL7d\n\n# Complexity\n- Time complexity: $$O(n)$$ \n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity: $$O(n)$$ \n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution {\npublic:\n    int numberOfSubarrays(vector<int>& nums, int k) {\n        unordered_map<int,int>mpp;\n        for(auto &num:nums){\n            if(num%2) num=1;\n            else num=0;\n        }\n        mpp[0]=1;\n        int count=0;\n        int sum=0;\n        for(int num:nums){\n            sum+=num;\n            count+=mpp[sum-k];\n            mpp[sum]++;\n        }\n        return count;\n    }\n};\n```
['C++']