class Solution:
def isValid(self, S: str) -> bool:
n = len(S)
if n % 3 != 0:
return False
while n!=0:
i = S.find('abc')
if i == -1:
return False
else:
S = S[0:i] + S[i+3:]
n = len(S)
return True

leetcode1003的更多相关文章

  1. [Swift]LeetCode1003. 检查替换后的词是否有效 | Check If Word Is Valid After Substitutions

    We are given that the string "abc" is valid. From any valid string V, we may split V into ...

随机推荐

  1. dropwizard使用cors支持跨域浏览器取不到自定义header问题

    dropwizard支持cors的配置如下: public void run(Configuration conf, Environment environment) { // Enable CORS ...

  2. WireGuard协议介绍

    原文: https://www.jianshu.com/p/32c3e62c2711

  3. [UE4]Datasmith

    Datasmith 是帮助您将内容导入到虚幻引擎4中的一组工具和插件. 作为虚幻工作室产品的部分,Datasmith设计用于解决非游戏行业人士所面临的独特挑战,例如建筑.工程.建造.制造.实时培训等行 ...

  4. Go语言 数据类型,流程控制

    Go语言 数据类型,流程控制 人生苦短,Let's Go ! package main // 必须要有一个main包 import "fmt" func main() { fmt. ...

  5. Find the peace with yourself

    The purpose of being mature is to find the real calm and peace with yourself. Or you can say the tur ...

  6. 将本地代码提交至gitHub

    1.注册github账号 2.本地安装git 3.打开需要提交代码的目录 4.右击git bash here 5. $ git init 6  $ ssh-keygen -t rsa -C " ...

  7. 让WordPress支持google AMP

    1.关于AMP 在移动互联网的时代,尽管网站响应式设计可以满足多屏(pc.手机.ipad等)浏览,但google在2015年10月推出了更快移动页面访问速度的技术-Accelerated Mobile ...

  8. RSA加密解密,String转PublicKey、PrivateKey;附Base64.JAR

    网络请求的数据需要加密,服务器给的他们那一套在Android一直报错,自己写了一个: package com.cc.common.util; import javax.crypto.Cipher; i ...

  9. Ddr2,ddr3,ddr4内存条的读写速率

    理论极限值是可以计算的:1333MHz * 64bit(单通道,双通道则128bit) / 8(位到字节单位转换) = 10.664GB/s.这只是理论,实际发挥还要看内存控制器,实际上1333单条跑 ...

  10. python开发学习(元组、字符串、列表、字典深入)

    https://www.cnblogs.com/songqingbo/p/5129116.html(转载学习)