Good  faster Solution
IntuitionThe problem requires us to find elements in the array that are greater than their neighboring elements at a given distance k on both sides. The sum of
# Intuition
The problem requires us to find elements in the array that are greater than their neighboring elements at a given distance k on both sides. The sum of such “good” elements will be our final result.

# Approach

1.	Edge Case Handling: If the input array is empty, return 0.
2. 	Iteration: Iterate through each element in the array and check whether it is greater than the element at index i - k (left) and i + k (right), if those indices exist.
3.	Validation: If both conditions hold true, add the current element to the result.
4.	Return the Result: After traversing the array, return the accumulated sum of “good” numbers.

# Complexity
- Time complexity:
 O(n) , where  n  is the number of elements in the array. We iterate through the array once, and index lookups are  O(1) .

- Space complexity:
 O(1) , as we use only a few extra variables for computations and do not allocate additional space proportional to input size.


# Code
```swift []
class Solution {
func sumOfGoodNumbers(_ nums: [Int], _ k: Int) -> Int {
	guard !nums.isEmpty else { return 0 }
	var result = 0
	var indices = nums.indices


	for i in 0..<nums.count {
		var isLeftBigger = indices.contains(i - k) ? nums[i] > nums[i - k] : true
		var isRightBigger = indices.contains(i + k) ? nums[i] > nums[i + k] : true

		guard isLeftBigger && isRightBigger else { continue }
		result += nums[i]
	}

	return result
}
}
```
['Array', 'Swift']