समस्या
A password is strong if it has at least 8 characters, at least one uppercase letter, at least one lowercase letter and at least one digit (English letters and 0–9).
Implement is_strong_password(password).
Input
password: The password to check (ASCII characters).
Output
Return true if all rules hold, otherwise false.
सीमाएँ
0 ≤ length of password ≤ 100
उदाहरण
इनपुट:
password = "Secret123"
अपेक्षित आउटपुट:
expected = True
इनपुट:
std::string password = "Secret123";
अपेक्षित आउटपुट:
bool expected = true;
इनपुट:
string password = "Secret123";
अपेक्षित आउटपुट:
bool expected = true;
व्याख्या
9 characters with uppercase S, lowercase letters and digits: strong.
इनपुट:
password = "password1"
अपेक्षित आउटपुट:
expected = False
इनपुट:
std::string password = "password1";
अपेक्षित आउटपुट:
bool expected = false;
इनपुट:
string password = "password1";
अपेक्षित आउटपुट:
bool expected = false;
व्याख्या
There is no uppercase letter, so it is not strong.
कैसे हल करें
पहले खुद कोशिश करें, फिर एक-एक करके संकेत खोलें।
संकेत 1
Password ko ek saath kai independent conditions satisfy karni hoti hain.
संकेत 2
Check karte waqt track karo ki uppercase letter, lowercase letter, aur digit dekha hai ya nahi.
संकेत 3
Empty string ya short string turant fail hoti hai, chahe usmein mixed characters hi kyun na hon.
अपेक्षित जटिलता
समय O(n), अतिरिक्त स्थान O(1)
संदर्भ
यह चुनौती CodeUtility के लिए अनुकूलित की गई है। ऊपर दिए गए स्टेटमेंट और सीमाओं का पालन करें।