commit eeef87223e2abca54973a3b0e714dd24c043253e
parent 7829de912d4fb6170e53730d4af7882a4c6af3c7
Author: Dimitrije Dobrota <mail@dimitrijedobrota.com>
Date: Sun, 31 Dec 2023 13:30:26 +0000
Daily Problem
Diffstat:
2 files changed, 17 insertions(+), 0 deletions(-)
diff --git a/Problems/1624.cpp b/Problems/1624.cpp
@@ -0,0 +1,16 @@
+class Solution {
+ public:
+ int maxLengthBetweenEqualCharacters(const string &s) const {
+ static int index[27];
+ int res = -1;
+ memset(index, 0xFF, sizeof(index));
+ for (int i = 0; i < s.size(); i++) {
+ const int idx = s[i] & 0x1F;
+ if (index[idx] == -1)
+ index[idx] = i;
+ else
+ res = max(res, i - index[idx] - 1);
+ }
+ return res;
+ }
+};
diff --git a/README.md b/README.md
@@ -774,6 +774,7 @@ for solving problems.
| 1609 | Medium | [Even Odd Tree](Problems/1609.cpp) |
| 1611 | Hard | [Minimum One Bit Operations to Make Integers Zero](Problems/1611.cpp) |
| 1615 | Medium | [Maximal Network Rank](Problems/1615.cpp) |
+| 1624 | Easy | [Largest Substring Between Two Equal Characters](Problems/1624.cpp) |
| 1625 | Medium | [Lexicographically Smallest String After Applying Operations](Problems/1625.cpp) |
| 1626 | Medium | [Best Team With No Conflicts](Problems/1626.cpp) |
| 1630 | Medium | [Arithmetic Subarrays](Problems/1630.cpp) |