Easy Way to solve beginner freindly.
IntuitionVery easy implementation code....beginner freindly.ApproachUsing For loop and if statement easy implementationComplexity

Time complexity:
O(n)


Space
# Intuition
Very easy implementation code....beginner freindly.

# Approach
Using For loop and if statement easy implementation

# Complexity
- Time complexity:
 $$O(n)$$

- Space complexity:
$$O(1)$$

# Code
```python []
class Solution(object):
    def sumOfGoodNumbers(self, nums, k):
        """
        :type nums: List[int]
        :type k: int
        :rtype: int
        """
        total = 0
        n = len(nums)

        for i in range(n):
            left = i - k
            right = i + k
            
            # Check conditions
            if (left < 0 or nums[i] > nums[left]) and (right >= n or nums[i] > nums[right]):
                total += nums[i]
        
        return total

        
```
['Python']