 || ✅✅Beats 100% && #DAY_29th_Of_Daily_Coding🙏🙏 ||
JAI SHREE DATNA🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏Code
# JAI SHREE DATNA🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏
![image.png](https://assets.leetcode.com/users/images/668fd63d-6a2b-426e-a089-b8213ccd1981_1739703165.1002638.png)


# Code
```cpp []

class Solution {
public:
    int sumOfGoodNumbers(std::vector<int>& nums, int k) {
        int ans = 0; 
        int n = nums.size();  
        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) ans += nums[i]; 
        }
        return ans; 
    }
};
```
['C++']