Leetcode 1509. Minimum Difference Between Largest and Smallest Value in Three Moves
Given an integer array (n up to 1e5), you may change up to three elements to any value; return the minimum possible difference between the largest and smallest values after at most three moves. Key observation: after sorting, only four scenarios matter — remove k smallest and 3−k largest (k=0…3) — and take the minimal remaining range.
Question Timeline
See when this question was last asked and where, including any notes left by other candidates.
0
Hello Interview Premium
Your account is free and you can post anonymously if you choose.