JS reduce one-liner
Intuitionyep.Complexity

Time complexity:
O(n)


Space complexity:
O(1)

Code
# Intuition
yep.

# Complexity
- Time complexity:
$$O(n)$$

- Space complexity:
$$O(1)$$

# Code
```javascript []
/**
 * @param {number[]} nums
 * @param {number} k
 * @return {number}
 */
var sumOfGoodNumbers = function(nums, k) {
    return nums.reduce((acc, cur, i) => (cur > (nums[i - k] ?? -1)) && (cur > (nums[i + k] ?? -1)) ? acc + cur : acc, 0)
};
```
['JavaScript']