Sliding Window,PrefixSum Approach
\nclass Solution:\n    def numberOfSubarrays(self, nums: List[int], k: int) -> int:\n        prefixsum=0\n        dic=defaultdict(int)\n        dic[0]=1\n      
```\nclass Solution:\n    def numberOfSubarrays(self, nums: List[int], k: int) -> int:\n        prefixsum=0\n        dic=defaultdict(int)\n        dic[0]=1\n        ans=0\n        for i in nums:\n            if i%2==1:\n                prefixsum+=1\n            ans+=dic[prefixsum-k]\n            dic[prefixsum]+=1\n        return ans\n```\n# please upvote me it would encourage me alot\n
['Python3']