beats 99 % - Using Queue
Approach\nSimply Use the queue to store the indexes of odd elements.\nStart counting the subarrays when the Queue is of K size.\nMaintain two variables end and 
# Approach\nSimply Use the queue to store the indexes of odd elements.\nStart counting the subarrays when the Queue is of K size.\nMaintain two variables end and last to count the values that can be added to next index.\n\n# Complexity\n- Time complexity:\nOnly one iterations, e.g. $$O(n)$$\n\n- Space complexity:\nA Queue with max of k elements, e.g. $$O(k)$$\n\n# Code\n```\nclass Solution {\npublic:\n    int numberOfSubarrays(vector<int>& nums, int k) {\n        ios::sync_with_stdio(false);\n        cin.tie(0);\n        cout.tie(0);\n        queue<int> Q;\n        int lst = 0, end = -1, ans = 0;\n        for (int i = 0; i < nums.size(); i++) {\n            if(nums[i]&1){\n                Q.push(i);\n            }\n            if(Q.size() == k){\n                lst = end;\n                end = Q.front();\n                Q.pop();\n            }\n            if(end != -1){\n                ans += end - lst;\n            }\n        }\n        return ans;\n    }\n};\n```
['Greedy', 'Queue', 'C++']