Company: IBM___.
Difficulty: medium
Maximum Element After Decreasing and Rearranging Problem Description Given an array of integers, perform operations to satisfy the following constraints: The first array element must be 1. For all other elements, the difference between adjacent integers must not be greater than 1. In other words, for 1 ≤ i < n, arr[i] - arr[i-1] ≤ 1 . Available operations: Rearrange the elements in any way. Reduce any element to any number that is at least 1. Return the maximum value that can be achieved for the final element of the array. Example Input: arr = [3, 1, 3, 4] Output: 4 Explanation: To achieve the maximum possible final element, we can follow these steps: First, sort the array to get a non-decreasing sequence: [1, 3, 3, 4] . Set the first element to 1. In this case, it's already 1. The array remains [1, 3, 3, 4] . Iterate through the rest of the array and enforce the adjacent difference constraint. For the second element ( arr[1]=3 ), it must be at most arr[0] + 1 = 2 . We reduce