BEATS 100% || SOLUTION IN LOOP
IntuitionApproachComplexity
Time complexity:O(N)

Space complexity:O(1)
Code
# Intuition
<!-- Describe your first thoughts on how to solve this problem. -->

# Approach
<!-- Describe your approach to solving the problem. -->

# Complexity
- Time complexity:O(N)
<!-- Add your time complexity here, e.g. $$O(n)$$ -->

- Space complexity:O(1)
<!-- Add your space complexity here, e.g. $$O(n)$$ -->

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