Easy Code || Very Clean Code || C++ || O(N) Solution 
Upvote My Solution.Complexity
Time complexity:O(N)

Space complexity:O(1)
Code
***Upvote My Solution.***
# 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
```cpp []
class Solution {
private:
    bool check(vector<int > & nums, int k, int i){
        int n = nums.size();
        if((i-k)<0){
            // means therefore sirf i+k check krna hai!
            if(nums[i] > nums[i+k]){
                return true;
            }
            else return false; 
        }

        else{    // means peeche ka to check krenge he i-k hamesha
            // condn: (i-k) >= 0:
            if((i+k) < n ) {
                if(nums[i] > nums[i + k] && nums[i] > nums[i-k]){
                    // When Both True then it is a good Number
                    return true;
                }
                else return false; 
            }
            if((i+k) >= n){   // out of bonds chala gya h i+k therefore sirf left i-k check krenge
                // means Left Side pe checkkrna h sirf i.e i-k th index
                if(nums[i] > nums[i-k]){
                    return true;
                }
                else return false; 
            }
        }
        return false;       
    }
public:
    int sumOfGoodNumbers(vector<int>& nums, int k) {

        int n = nums.size();
        int ans = 0;

        for(int i = 0; i<n; i++){
            if(check(nums, k, i)){
                ans += nums[i];
            }
        }    
        return ans;
    }
};
```
['Array', 'C++']