C++ O(N) Solution (Beats 100% of Users)
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity: O(N)\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity: O(1)\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution {\npublic:\n    int solve(vector<int>& v, int k)\n    {\n        int i=0,j=0;\n        int odd=0,ans=0;\n        while(j<v.size())\n        {\n            if(v[j]%2==1) odd++;\n            while(odd>k)\n            {\n                if(v[i++]%2==1) odd--;\n            }\n            ans+=(j-i+1);\n            j++;\n        }\n        return ans;\n    }\n    int numberOfSubarrays(vector<int>& v, int k) {\n        std::ios_base::sync_with_stdio(false);\n        std::cout.tie(nullptr);\n        std::cin.tie(nullptr);\n        return solve(v,k)-solve(v,k-1);\n    }\n};\n```
['Sliding Window', 'C++']