leetcodeSolution to some Leetcode problems written in C++ |
git clone git://git.dimitrijedobrota.com/leetcode.git |
Log | Files | Refs | README | LICENSE | |
commit | 354bd86458e13a164c19891ed7ba4c699400697b |
parent | 4a1b8ae059ea168a9999459ec3187dfb8d8460c7 |
author | Dimitrije Dobrota <mail@dimitrijedobrota.com> |
date | Mon, 4 Dec 2023 11:55:36 +0000 |
Daily Problem
Diffstat:A | Problems/2264.cpp | | | ++++++++++++ |
M | README.md | | | + |
2 files changed, 13 insertions(+), 0 deletions(-)
diff --git a/Problems/2264.cpp b/Problems/2264.cpp
@@ -0,0 +1,12 @@
class Solution {
public:
string largestGoodInteger(const string &num) const {
int res = -1;
for (int i = 0; i < num.size() - 2; i++) {
if (num[i] == num[i + 1] && num[i] == num[i + 2]) {
res = max(res, num[i] & 0x0F);
}
}
return res == -1 ? "" : string(3, '0' + res);
}
};
diff --git a/README.md b/README.md
@@ -846,6 +846,7 @@ for solving problems.
| 2244 | Medium | [Minimum Rounds to Complete All Tasks](Problems/2244.cpp) |
| 2246 | Hard | [Longest Path With Different Adjacent Characters](Problems/2246.cpp) |
| 2251 | Hard | [Number of Flowers in Full Bloom](Problems/2251.cpp) |
| 2264 | Easy | [Largest 3-Same-Digit Number in String](Problems/2264.cpp) |
| 2265 | Medium | [Count Nodes Equal to Average of Subtree](Problems/2265.cpp) |
| 2265 | Medium | [Count Nodes Equal to Average of Subtree](Problems/2265.cpp) |
| 2272 | Hard | [Substring With Largest Variance](Problems/2272.cpp) |