Excess when executing100%User,What can I say about this question,But oneBit operationKnowledge point
My code:
1 | class Solution: |
Bit operation代码:
method one:simulation + Bit operation
According to the description of the topic,我们可以simulation检查密码是否满足题目要求的过程。
first,We check whether the length of the password is less than 8,in the case of,Then return false。
Next,We use a mask mask To record whether the password contains a lowercase letter、uppercase letter、Numbers and special characters。We traverse the password,Like a character every time,First determine whether it is the same as the previous character,in the case of,Then return false。Then,Update mask according to the type of character mask。at last,We check the mask mask Whether it is 15,in the case of,Then return true,否Then return false。
1 | class Solution: |
author:ylb
Link:https://leetcode.cn/problems/strong-password-checker-ii/solutions/2068878/by-lcbin-hk2a/