#3224

Minimum Array Changes to Make Differences Equal

expert · 1165 · lc medium +32 · 24.3% accepted · 253 likes · top 3%

Description

You are given even-length integer array nums of size n and integer k. One change lets you replace any element with any integer in [0, k].

Find the minimum changes so some value X satisfies abs(a[i] - a[n - i - 1]) = X for all valid i.

Code

1
2
3