Python Solution Prefix Sum
\ndef numberOfSubarrays(self, nums, k):\n        """\n        :type nums: List[int]\n        :type k: int\n        :rtype: int\n        """\n        res = 0\n  
```\ndef numberOfSubarrays(self, nums, k):\n        """\n        :type nums: List[int]\n        :type k: int\n        :rtype: int\n        """\n        res = 0\n        count = 0\n        prefix = {}\n        prefix[0] = 1\n        for i in range(len(nums)):\n            \n            if nums[i] % 2 != 0:\n                count += 1\n            if count in prefix:\n                prefix[count] += 1\n            else: \n                prefix[count] = 1\n\t"""the key of prefix represent the number of odd number untill  certain position, the value represent the number of positions"""\n        \n        for c in prefix:\n            if c - k in prefix:\n                res += prefix[c] *prefix[c - k]\n        return res\n ```
[]