Given an array of integers
nums
and an integerk
, an elementnums[i]
is considered good if it is strictly greater than the elements at indicesi - k
andi + k
(if those indices exist). If neither of these indices exists,nums[i]
is still considered good.Return the sum of all the good elements in the array.
1 | package main |