Maximum Element After Decreasing and Rearranging

Medium · Greedy · about 15 minutes

Asked at Google, Amazon, Bloomberg.

Rearrange arr and decrease any elements so that the first element is 1 and adjacent elements differ by at most

  • Return the largest possible maximum element.