leetcode

Solution to some Leetcode problems written in C++
git clone git://git.dimitrijedobrota.com/leetcode.git
Log | Files | Refs | README | LICENSE |

commite321f5185bb80c85ae2867eeba07125b55060f98
parentc4a8b500bf5d89f59e1fa436d56897c29cad0094
authorDimitrije Dobrota <mail@dimitrijedobrota.com>
dateThu, 19 Dec 2024 10:40:16 +0100

1 Random Problem

Diffstat:
AProblems/2136.cpp|++++++++++++++++++
MREADME.md|+

2 files changed, 19 insertions(+), 0 deletions(-)


diff --git a/Problems/2136.cpp b/Problems/2136.cpp

@@ -0,0 +1,18 @@

class Solution {
public:
int earliestFullBloom(const vector<int> &plantTime, const vector<int> &growTime) const {
const int n = size(plantTime);
static int idxs[100001];
iota(idxs, idxs + n, 0);
sort(idxs, idxs + n, [&](int a, int b) { return growTime[a] > growTime[b]; });
int res = 0, acc = 0;
for (const int i : span(idxs, n)) {
acc += plantTime[i];
res = max(res, acc + growTime[i]);
}
return res;
}
};

diff --git a/README.md b/README.md

@@ -1217,6 +1217,7 @@ reference and a base for solving problems.

| 2130 | Medium | [Maximum Twin Sum of a Linked List](Problems/2130.cpp) |
| 2131 | Medium | [Longest Palindrome by Concatenating Two Letter Words](Problems/2131.cpp) |
| 2134 | Medium | [Minimum Swaps to Group All 1's Together II](Problems/2134.cpp) |
| 2136 | Hard | [Earliest Possible Day of Full Bloom](Problems/2136.cpp) |
| 2139 | Medium | [Minimum Moves to Reach Target Score](Problems/2139.cpp) |
| 2140 | Medium | [Solving Questions With Brainpower](Problems/2140.cpp) |
| 2141 | Hard | [Maximum Running Time of N Computers](Problems/2141.cpp) |