Maximum Beauty of an Array After Applying Operation
Sort the values and slide a window whose spread is at most 2k, since each value can move by k in either direction.
Sort the values and slide a window whose spread is at most 2k, since each value can move by k in either direction.