commit e8126fedfa89c63b8819d1b5c9ab182b6e611040
parent 517068125b2d587cff41957dfe11480c46048b64
Author: Dimitrije Dobrota <mail@dimitrijedobrota.com>
Date: Sun, 15 Dec 2024 13:51:15 +0100
1 Random Problem
Diffstat:
2 files changed, 13 insertions(+), 0 deletions(-)
diff --git a/Problems/1526.cpp b/Problems/1526.cpp
@@ -0,0 +1,12 @@
+class Solution {
+ public:
+ int minNumberOperations(const vector<int> &target) const {
+ int res = target[0];
+
+ for (int i = 1; i < size(target); i++) {
+ res += max(target[i] - target[i - 1], 0);
+ }
+
+ return res;
+ }
+};
diff --git a/README.md b/README.md
@@ -967,6 +967,7 @@ reference and a base for solving problems.
| 1519 | Medium | [Number of Nodes in the Sub-Tree With the Same Label](Problems/1519.cpp) |
| 1523 | Easy | [Count Odd Numbers in an Interval Range](Problems/1523.cpp) |
| 1525 | Medium | [Number of Good Ways to Split a String](Problems/1525.cpp) |
+| 1526 | Hard | [Minimum Number of Increments on Subarrays to Form a Target Array](Problems/1526.cpp) |
| 1527 | Easy | [Patients With a Condition](Problems/1527.cpp) |
| 1529 | Medium | [Minimum Suffix Flips](Problems/1529.cpp) |
| 1530 | Medium | [Number of Good Leaf Nodes Pairs](Problems/1530.cpp) |