2439.cpp (270B)
1 class Solution { 2 public: 3 int minimizeArrayValue(vector<int> &nums) { 4 long sum = 0, res = 0; 5 for (int i = 0; i < nums.size(); ++i) { 6 sum += nums[i]; 7 res = max(res, (sum + i) / (i + 1)); 8 } 9 return res; 10 } 11 };