agar k >n hua to . 
IntuitionApproachComplexity
Time complexity:

Space complexity:
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)$$ -->

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

# Code
```cpp []

class Solution {
public:
    int sumOfGoodNumbers(std::vector<int>& nums, int k) {
        int totalSum = 0; 
        int n = nums.size(); 
        if (k>n) k=k%n;
        
        for (int i = 0; i < n; i++) {
            bool flag = true; 
            
            if (i - k >= 0) { 
                if (nums[i] <= nums[i - k]) { 
                    flag = false; 
                }
            }
            if (i + k < n) { 
                if (nums[i] <= nums[i + k]) { 
                    flag = false; 
                }
            }
            if (flag==true) {
                totalSum += nums[i];
            }
        }
        return totalSum; 
    }
};
```
['C++']