Easy C++ solution
\nclass Solution \n{\npublic:\n    // Function to calculate the number of subarrays having count of odd numbers lees than or equals to k\n    int helper(vector<
```\nclass Solution \n{\npublic:\n    // Function to calculate the number of subarrays having count of odd numbers lees than or equals to k\n    int helper(vector<int>&nums,int k)\n    {\n        int ans=0,i=0,count=0;\n        for(int j=0;j<nums.size();j++)\n        {\n            if(nums[j]%2!=0)\n            {\n                count++;\n            }\n            while(i<=j && count>k)\n            {\n                if(nums[i]%2!=0)\n                {\n                    count--;\n                }\n                i++;\n            }\n            ans+=(j-i+1);\n        }\n        return ans;\n    }\n    int numberOfSubarrays(vector<int>& nums, int k) \n    {\n        // Number of subarrays with count of odd numbers <=k = (Numbers of subarrays with count of odd numbers <k + Numbers of subarrays with count of odd numbers =k)\n        // so if we exclude the number of subarrays with odd number count less than k from number of subarrays with odd number count equals to k , we\'ll get our answer.\n        return helper(nums,k)-helper(nums,k-1);\n    }\n};\n```\n**Please upvote if you have got any help from my code. Thank you.**
['C']