leetcodeSolution to some Leetcode problems written in C++ |
git clone git://git.dimitrijedobrota.com/leetcode.git |
Log | Files | Refs | README | LICENSE | |
commit | 30e288026d578095e0352f474bcf7b547e444ed9 |
parent | d6f37938238c723c3d5c22c960f869677a17d3b7 |
author | Dimitrije Dobrota <mail@dimitrijedobrota.com> |
date | Thu, 2 May 2024 08:33:39 +0200 |
Daily Problem
Diffstat:A | Problems/2441.cpp | | | +++++++++++++++ |
M | README.md | | | + |
2 files changed, 16 insertions(+), 0 deletions(-)
diff --git a/Problems/2441.cpp b/Problems/2441.cpp
@@ -0,0 +1,15 @@
class Solution {
public:
int findMaxK(const vector<int> &nums) const {
static uint8_t us[2001];
int res = -1;
memset(us, 0x00, sizeof(us));
for (const int n : nums) {
if (us[-n + 1000]) res = max(res, abs(n));
us[n + 1000] = 1;
}
return res;
}
};
diff --git a/README.md b/README.md
@@ -1109,6 +1109,7 @@ for solving problems.
| 2428 | Medium | [Maximum Sum of an Hourglass](Problems/2428.cpp) |
| 2433 | Medium | [Find The Original Array of Prefix Xor](Problems/2433.cpp) |
| 2439 | Medium | [Minimize Maximum of Array](Problems/2439.cpp) |
| 2441 | Easy | [Largest Positive Integer That Exists With Its Negative](Problems/2441.cpp) |
| 2442 | Medium | [Count Number of Distinct Integers After Reverse Operations](Problems/2442.cpp) |
| 2444 | Hard | [Count Subarrays With Fixed Bounds](Problems/2444.cpp) |
| 2448 | Hard | [Minimum Cost to Make Array Equal](Problems/2448.cpp) |