Easy Explain || Beats 100%  
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:
<!-- Add your time complexity here, e.g. $$O(n)$$ -->
O(n)

- Space complexity:
<!-- Add your space complexity here, e.g. $$O(n)$$ -->
O(1)
# Code
```cpp []
class Solution {
public:
    int sumOfGoodNumbers(vector<int>& nums, int k) {
        int n=nums.size();
        int sum=0;
        for(int i=0;i<n;i++)
        {
            int t=1;
            if(i>=k && nums[i-k]>=nums[i])
            t=0;
            if(i+k<n && nums[i+k]>=nums[i])
            t=0;
            if(t)
            sum+=nums[i];
        }
        return sum;
    }
};
```
['C++']