Beats 100% | Python 3 
Please UpvoteCode
# Please Upvote

# Code
```python3 []
class Solution:
    def sumOfGoodNumbers(self, nums: List[int], k: int) -> int:
        n, ans = len(nums), 0
        for i in range(n):
            if i+k<n:
                if nums[i]<=nums[i+k]:
                    continue
            if 0<=i-k:
                if nums[i]<=nums[i-k]:
                    continue
            ans+=nums[i]
        return ans
```
['Array', 'Python3']