👨🏻‍💻Super EASY CODE ✅✅ | C , C++ , JAVA , Python
CodeCodeCodeCode⬆️PLS UPVOTE IF U LIKED MY SOLUTION⬆️
# Code
```c []
int sumOfGoodNumbers(int* nums, int numsSize, int k) {
    int sum=0;
    for(int i=0;i<numsSize;i++){
        bool isGood=true;
        if(i-k>=0 && nums[i] <= nums[i-k]) isGood = false;
        if(i+k<numsSize && nums[i] <= nums[i+k]) isGood = false;
        if(isGood) sum += nums[i];
    }
    return sum;
}
```
# Code
```cpp []
class Solution {
public:
    int sumOfGoodNumbers(vector<int>& nums, int k) {
        int sum=0;
        for(int i=0;i<nums.size();i++){
            bool isGood=true;
            if(i-k>=0 && nums[i] <= nums[i-k]) isGood=false;
            if(i+k<nums.size() && nums[i] <= nums[i+k]) isGood = false;
            if(isGood) sum += nums[i];
        }
        return sum;
    }
};
```

# Code
```java []
class Solution {
    public int sumOfGoodNumbers(int[] nums, int k) {
        int sum=0;
        for(int i=0;i<nums.length;i++){
            boolean isGood=true;
            if(i-k>=0 && nums[i] <= nums[i-k]) isGood=false;
            if(i+k<nums.length && nums[i] <= nums[i+k]) isGood = false;
            if(isGood) sum += nums[i];
        }
        return sum;
    }
}
```

# Code
```Python []
class Solution:
    def sumOfGoodNumbers(self, nums: List[int], k: int) -> int:
        total_sum = 0
        for i in range(len(nums)):
            if (i - k < 0 or nums[i] > nums[i - k]) and (i + k >= len(nums) or nums[i] > nums[i + k]):
                total_sum += nums[i]
        return total_sum
```

***
***

 # *⬆️PLS UPVOTE IF U LIKED MY SOLUTION⬆️* 
---
['Array', 'C', 'C++', 'Java', 'Python3']