Minimum Replacements to Sort the Array
Scan from the right and split each value into as few parts as possible, keeping its smallest part as large as allowed.
Scan from the right and split each value into as few parts as possible, keeping its smallest part as large as allowed.