[C++][O(N) Prefix Sum]
\nclass Solution {\npublic:\n    int numberOfSubarrays(vector<int>& nums, int k) {\n        vector<int> prefixSum(nums.size());\n        \n        for(int i = 0
```\nclass Solution {\npublic:\n    int numberOfSubarrays(vector<int>& nums, int k) {\n        vector<int> prefixSum(nums.size());\n        \n        for(int i = 0; i < nums.size(); i++){\n            if (nums[i] % 2 == 1){\n                prefixSum[i] = 1;\n            }\n        }\n        \n        for(int i = 1; i < nums.size(); i++){\n            prefixSum[i] += prefixSum[i - 1];\n        }\n        \n        unordered_map<int,int> map;\n        \n        map[0] = 1;\n        \n        int ans = 0;\n        for(int i = 0; i < nums.size(); i++){\n            if (prefixSum[i] - k >= 0){\n                ans += map[prefixSum[i] - k];\n            }\n            map[prefixSum[i]]++;\n        }\n        \n\n        return ans;\n    }\n};\n```
[]