#include <leetcode.h>
◆ strongPasswordChecker()
int leetcode::strong_password_checker::Solution::strongPasswordChecker |
( |
const string & |
password | ) |
|
|
static |
在文件 leetcode.cpp 第 5373 行定义.
5374 const int n = password.length();
5375 bool has_lower =
false;
5376 bool has_upper =
false;
5377 bool has_digit =
false;
5378 for(
const char ch: password) {
5379 if(islower(ch) != 0) {
5381 }
else if(isupper(ch) != 0) {
5383 }
else if(isdigit(ch) != 0) {
5387 const int categories =
static_cast<int>(has_lower) +
static_cast<int>(has_upper) +
static_cast<int>(has_digit);
5390 return max(6 - n, 3 - categories);
5397 for(
const char ch: password) {
5401 replace += count / 3;
5406 replace += count / 3;
5407 return max(replace, 3 - categories);
5417 for(
const char ch: password) {
5421 if(
remove > 0 && count >= 3) {
5422 if(count % 3 == 0) {
5426 }
else if(count % 3 == 1) {
5432 replace += count / 3;
5437 if(
remove > 0 && count >= 3) {
5438 if(count % 3 == 0) {
5441 }
else if(count % 3 == 1) {
5445 replace += count / 3;
5448 const int use2 = min({replace, rm2,
remove / 2});
5452 const int use3 = min(replace,
remove / 3);
5455 return n - 20 + max(replace, 3 - categories);
void remove(TreeNode *&root, int x)
引用了 acwing::acwing3786::remove().
被这些函数引用 leetcode::strong_password_checker::TEST().
该类的文档由以下文件生成: