Very Easy C++ Solution in O(n) - beats 99.48% submissions
To achieve good time complexity we need to use bit munpulation for checking odd number\n\nTime Complexity: O(n)\nSpace Complexity: O(1)\n\n#pragma GCC optimize(
To achieve good time complexity we need to use bit munpulation for checking odd number\n\nTime Complexity: O(n)\nSpace Complexity: O(1)\n```\n#pragma GCC optimize("Ofast")  \n#pragma GCC target("avx,avx2,fma") \nstatic auto _ = [] ()\n{ios_base::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr);return 0;}();\n\nclass Solution {\npublic:\n    int numberOfSubarrays(vector<int>& nums, int k) {\n        int j = 0, odd = 0, ctr = 0, ans = 0;\n        for (int i = 0; i < nums.size(); i++) \n        {\n            if (nums[i] & 1)\n            {\n                odd++;\n                if (odd >= k) \n                {\n                    ctr = 1;\n                    while (!(nums[j++] & 1))\n                        ctr++;\n                    ans += ctr;\n                }\n            \n            } else if (odd >=k) \n                ans += ctr;\n        }\n        return ans;\n    }\n};\n```
['Two Pointers', 'C++']