Easy One
Codeclass Solution:
def sumOfGoodNumbers(self, nums: List[int], k: int) -> int:
summ = 0
n = len(nums)

# Code

class Solution:
    def sumOfGoodNumbers(self, nums: List[int], k: int) -> int:
        summ = 0
        n = len(nums)
        
        for i in range(n):
            if (i - k >= 0 and i + k < n):  # Both indices exist
                if nums[i] > nums[i - k] and nums[i] > nums[i + k]:
                    summ += nums[i]
            elif (i - k < 0 and i + k < n):  # Only `i + k` exists
                if nums[i] > nums[i + k]:
                    summ += nums[i]
            elif (i - k >= 0 and i + k >= n):  # Only `i - k` exists
                if nums[i] > nums[i - k]:
                    summ += nums[i]
            else:  # Neither `i - k` nor `i + k` exist (edge case, always good)
                summ += nums[i]

        return summ

```
['Python3']