Search
⌘K

Leetcode 2009. Minimum Number of Operations to Make Array Continuous

Given an array where you can replace any element with any integer, compute the minimum replacements to make all elements unique and form a consecutive sequence of length n (max-min = n-1). Equivalently, deduplicate and use a sliding-window on the sorted unique values to maximize how many original values fit inside an interval of length n-1, then return n minus that count.


Question Timeline

See when this question was last asked and where, including any notes left by other candidates.

Comments

Your account is free and you can post anonymously if you choose.