暴力查找

class Solution:
def camelMatch(self, queries: List[str], pattern: str) -> List[bool]:
q_size=len(queries)
p_size=len(pattern)
ans=[True for i in range(q_size)]
for i,query in enumerate(queries):
idx=[query.find(pattern[0])]
if idx[-1]==-1:
ans[i]=False
continue
for p in pattern[1:]:
id = query[idx[-1]+1:].find(p)
if id==-1:
idx.append(-1)
break
else:
idx.append(idx[-1]+1+id)
if idx[-1]==-1:
ans[i]=False
continue
for j,v in enumerate(query):
if not (j in idx):
if not v.islower():
ans[i]=False
break
return ans

Leetcode 1023. Camelcase Matching的更多相关文章

  1. 【LEETCODE】70、字符匹配1023 Camelcase Matching

    最近做leetcode总感觉自己是个智障,基本很少有题能自己独立做出来,都是百度... 不过终于还是做出了一题...而且速度效率还可以 哎,加油吧,尽量锤炼自己 package y2019.Algor ...

  2. 【LeetCode】1023. Camelcase Matching 解题报告(Python)

    作者: 负雪明烛 id: fuxuemingzhu 个人博客: http://fuxuemingzhu.cn/ 目录 题目描述 题目大意 解题方法 正则+字典 日期 题目地址:https://leet ...

  3. 【leetcode】1023. Camelcase Matching

    题目如下: A query word matches a given pattern if we can insert lowercaseletters to the pattern word so ...

  4. 1023. Camelcase Matching驼峰式匹配

    网址:https://leetcode.com/problems/camelcase-matching/ 依题意可得逻辑 class Solution { public: vector<bool ...

  5. [LeetCode] Regular Expression Matching 正则表达式匹配

    Implement regular expression matching with support for '.' and '*'. '.' Matches any single character ...

  6. Java for LeetCode 044 Wildcard Matching

    Implement wildcard pattern matching with support for '?' and '*'. '?' Matches any single character. ...

  7. LeetCode | Regular Expression Matching

    Regular Expression Matching Implement regular expression matching with support for '.' and '*'. '.' ...

  8. [leetcode]Regular Expression Matching @ Python

    原题地址:https://oj.leetcode.com/problems/regular-expression-matching/ 题意: Implement regular expression ...

  9. [LeetCode] 44. Wildcard Matching 外卡匹配

    Given an input string (s) and a pattern (p), implement wildcard pattern matching with support for '? ...

随机推荐

  1. (转)Springboot+shiro配置笔记+错误小结

    springboot不像springmvc,它没有xml配置文件,那该如何配置shiro呢,其实也不难,用java代码+注解来解决这个问题.仅以此篇记录我对shiro的学习,如有对过客造成不便,实在抱 ...

  2. python + unittest 做单元测试之学习笔记

    单元测试在保证开发效率.可维护性和软件质量等方面有很重要的地位,所谓的单元测试,就是对一个类,一个模块或者一个函数进行正确性检测的一种测试方式. 这里主要是就应用 python + unitest 做 ...

  3. Js中的filter()方法

    /* filter()方法使用指定的函数测试所有元素,并创建一个包含所有通过测试的元素的新数组. filter()基本语法: arr.filter(callback[, thisArg]) filte ...

  4. Bootstrap按钮组学习

    简介 通过按钮组容器把一组按钮放在同一行里.通过与按钮插件联合使用,可以设置为单选框或多选框的样式和行为. 按钮组中的工具提示和弹出框需要特别的设置 当为 .btn-group 中的元素应用工具提示或 ...

  5. Qml应用程序的性能考虑与建议

    本文翻译自Qt官网文档: http://doc.qt.io/qt-5/qtquick-performance.html QtQml应用程序的性能考虑与建议 1.时间考虑 作为一名程序开发者,应该努力使 ...

  6. postman--实现接口自动化测试

    postman使用 开发中经常用postman来测试接口,一个简单的注册接口用postman测试: 接口正常工作只是最基本的要求,经常要评估接口性能,进行压力测试. postman进行简单压力测试 下 ...

  7. pyDay10

    内容来自廖雪峰的官方网站. 1.python的赋值语句:a, b, c = x, y, z 相当于 a = x, b = y, c = z.(事实上等式右边是一个tuple) 2.获得genarato ...

  8. Window 常用系统变量

    转载:http://www.slyar.com/blog/envionment-variables.html 转载:http://blog.csdn.net/wuliusir/article/deta ...

  9. 学习Zookeeper之第1章Zookeeper入门

    第 1 章 Zookeeper入门 1.1 概述 1.2 特点 1.3 数据结构 1.4 应用场景 统一命名服务 统一配置管理 统一集群管理 服务器动态上下线 软负载均衡 1.5 下载地址 第 1 章 ...

  10. 面向对象之php多态

    php是面向对象的脚本语言,而我们都知道,面向对象的语言具有三大特性:封装,继承,多态(接口的多种不同的实现方式即为多态). 封装是类的构建过程,php具有.php也具有继承的特性.唯独这个多态,ph ...