We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent f9f20ea commit c9d716fCopy full SHA for c9d716f
Python/strong-password-checker-ii.py
@@ -0,0 +1,17 @@
1
+# Time: O(n)
2
+# Space: O(1)
3
+
4
+# string
5
+class Solution(object):
6
+ def strongPasswordCheckerII(self, password):
7
+ """
8
+ :type password: str
9
+ :rtype: bool
10
11
+ SPECIAL = set("!@#$%^&*()-+")
12
+ return (len(password) >= 8 and
13
+ any(c.islower() for c in password) and
14
+ any(c.isupper() for c in password) and
15
+ any(c.isdigit() for c in password) and
16
+ any(c in SPECIAL for c in password) and
17
+ all(password[i] != password[i+1] for i in xrange(len(password)-1)))
0 commit comments