NeetCode #807LC-1846MediumGreedy
← Back to All Problems

#807 · #1846 · Maximum Element After Decreasing and Rearranging(减小和重新排列数组后的最大元素)

📌 Problem Statement & Constraints

You are given an array of positive integers arr. You may rearrange the elements and decrease any element (but never increase one). The final array must satisfy two rules: its first element is exactly 1, and the absolute difference between every pair of adjacent elements is at most 1. Return the maximum possible value of the last element. Constraints: 1 <= arr.length <= 10^5, 1 <= arr[i] <= 10^9.
🔒

Sign In to Unlock Full Solutions for All 973 Problems

Sign in to access step-by-step logic, benchmark Python3 code, complexity breakdown, and offline export!