This commit is contained in:
2025-11-16 21:10:46 +08:00
parent 6b74b03d0f
commit f5ce056f2d
3 changed files with 75 additions and 0 deletions

17
25/11/3228-unfinish.cpp Normal file
View File

@@ -0,0 +1,17 @@
#include <string>
int maxOperations(std::string s) {
int countOne = 0;
int ans = 0;
for (int i = 0; i < s.length(); i++) {
if (s[i] == '0') {
while ((i + 1) < s.length() && s[i + 1] == '0') {
i++;
}
ans += countOne;
} else {
countOne++;
}
}
return ans;
}