commit 115a74cf6f7f8049cc79e16ac9e9b5e57c81b2c9
parent c8b1a228cfc22ed4f29d1877f317802c7b30a6bf
Author: Dimitrije Dobrota <mail@dimitrijedobrota.com>
Date: Wed, 5 Apr 2023 12:42:11 +0200
Daily Problem
Diffstat:
2 files changed, 12 insertions(+), 0 deletions(-)
diff --git a/Problems/2439.cpp b/Problems/2439.cpp
@@ -0,0 +1,11 @@
+class Solution {
+public:
+ int minimizeArrayValue(vector<int> &nums) {
+ long sum = 0, res = 0;
+ for (int i = 0; i < nums.size(); ++i) {
+ sum += nums[i];
+ res = max(res, (sum + i) / (i + 1));
+ }
+ return res;
+ }
+};
diff --git a/README.md b/README.md
@@ -495,6 +495,7 @@ for solving problems.
| 2390 | Medium | [Removing Stars From a String](Problems/2390.cpp) |
| 2405 | Medium | [Optimal Partition of String](Problems/2405.cpp) |
| 2421 | Medium | [Number of Good Paths](Problems/2421.cpp) |
+| 2439 | Medium | [Minimize Maximum of Array](Problems/2439.cpp) |
| 2444 | Hard | [Count Subarrays With Fixed Bounds](Problems/2444.cpp) |
| 2461 | Medium | [Maximum Sum of Distinct Subarrays With Length K](Problems/2461.cpp) |
| 2465 | Easy | [Number of Distinct Averages](Problems/2465.cpp) |