当前位置:网站首页>leetcode:6095. 强密码检验器 II【简单模拟 + 不符合直接False】
leetcode:6095. 强密码检验器 II【简单模拟 + 不符合直接False】
2022-06-12 18:36:00 【白速龙王的回眸】
分析
简单模拟
ac code
class Solution:
def strongPasswordCheckerII(self, password: str) -> bool:
if len(password) < 8:
return False
flag1, flag2, flag3, flag4 = False, False, False, False
for c in password:
if c.isdigit():
flag1 = True
elif 'a' <= c <= 'z':
flag2 = True
elif 'A' <= c <= 'Z':
flag3 = True
elif c in '[email protected]#$%^&*()-+':
flag4 = True
if flag1 == False or flag2 == False or flag3 == False or flag4 == False:
return False
for i in range(1, len(password)):
if password[i - 1] == password[i]:
return False
return True
总结
多条件判断
边栏推荐
- Solution to the problem that the anaconda navigator card logo cannot be opened and the card will flash back - replace the alicloud image source
- [blockbuster release] ant dynamic card, enabling the app home page to realize agile update
- MYSQL:Expression #4 of SELECT list is not in GROUP BY clause and contains nonaggregated column
- Relationship between resolution and line field synchronization signal
- 实验10 Bezier曲线生成-实验提高-控制点生成B样条曲线
- js二分法
- 基于Halcon的螺栓螺丝部分划痕、腐蚀缺陷检测
- VirtualLab basic experiment tutorial -5 Poisson bright spot
- 基于STM32设计智能家居控制系统(OneNet)_2022
- Review of MySQL (V): Joint table query and sub query
猜你喜欢
Shenzhen has been shut down for 7 days since March 14. Home office experience | community essay solicitation
Write a select based concurrent server
基于halcon—缺陷检测常用方法与示例总结
Topic 66: input array, exchange the largest element with the first element, exchange the smallest element with the last element, and output array.
"Big fat • small lesson" - talk about big file segmentation and breakpoint sequel
基于Halcon的矩形卡片【手动绘制ROI】的自由测量
快速复制浏览器F12中的请求到Postman/或者生成相关语言的对应代码
Still using Microsoft office, 3 fairy software, are you sure you don't want to try?
C language learning -- data storage in memory
A story on the cloud of the Centennial Olympic Games belonging to Alibaba cloud video cloud
随机推荐
Pytest automated testing framework (II)
Gospel of audio and video developers, rapid integration of AI dubbing capability
Review of MySQL (4): sorting operation
torch.where的新用法(很老但是大家忽略的用法)
Gossip about the source code of redis 89
快速复制浏览器F12中的请求到Postman/或者生成相关语言的对应代码
从源码解析 MobX 响应式刷新机制
lua记录
【矩阵论 & 图论】期末考试复习思维导图
Title 66: input 3 numbers a, B, C, and output them in order of size.
Strings in JS (including leetcode examples) < continuous update ~>
Vue —— 进阶 vue-router 路由(二)(replace属性、编程式路由导航、缓存路由组件、路由的专属钩子)
"Big fat • small lesson" - talk about big file segmentation and breakpoint sequel
Review of MySQL (V): Joint table query and sub query
Still using Microsoft office, 3 fairy software, are you sure you don't want to try?
Research Report on the overall scale, major manufacturers, major regions, products and applications of Electric Screwdrivers in the global market in 2022
Quickly copy the request in browser F12 to postman/ or generate the corresponding code of the relevant language
配送交付时间轻量级预估实践-笔记
MySQL advanced learning notes
VirtualLab basic experiment tutorial -5 Poisson bright spot