C++ || Two Pointers || Clean Code
\nclass Solution {\npublic:\n    int numberOfSubarrays(vector<int>& nums, int k) {\n        int n = nums.size();\n        int ans = 0,odd = 0,cnt = 0;\n        
```\nclass Solution {\npublic:\n    int numberOfSubarrays(vector<int>& nums, int k) {\n        int n = nums.size();\n        int ans = 0,odd = 0,cnt = 0;\n        int l = 0,r = 0;\n        while(r<n)\n        {\n            if(nums[r]%2 != 0)\n            {\n                odd++;\n                cnt = 0;\n            }\n            while(odd == k)\n            {\n                ++cnt;\n                odd -= nums[l++]&1; \n            }\n            ans += cnt;\n            r++;\n        }\n        return ans;\n    }\n};\n```\n# If you find my solution useful , then kindly upvote it.
['Two Pointers', 'C', 'Sliding Window']