2 POINTER SIMPLE APPROACH || PYTHON 3
\r\n# Code\r\n\r\nclass Solution:\r\n    def numberOfSubarrays(self, nums: List[int], k: int) -> int:\r\n        count = 0\r\n        i = 0\r\n        j = 0\r\n
\r\n# Code\r\n```\r\nclass Solution:\r\n    def numberOfSubarrays(self, nums: List[int], k: int) -> int:\r\n        count = 0\r\n        i = 0\r\n        j = 0\r\n        temp = 0\r\n        ans = 0\r\n        while(j<len(nums)):\r\n\r\n            if nums[j]%2!=0:\r\n                temp+=1\r\n                count = 0\r\n\r\n            if temp==k:\r\n                while(nums[i]%2==0):\r\n                    count+=1\r\n                    i+=1\r\n                count+=1\r\n                i+=1\r\n                temp-=1\r\n            \r\n            ans +=count\r\n            j+=1\r\n\r\n        return ans\r\n```
['Array', 'Two Pointers', 'Sliding Window', 'Python3']