当前位置:网站首页>leetcode:6097. Match [set record + query one by one with the same length] after replacing characters
leetcode:6097. Match [set record + query one by one with the same length] after replacing characters
2022-06-12 18:43:00 【Review of the white speed Dragon King】

analysis
use set Record replaceable
And then s Find length and sub same
And then we'll see if we can map In the past
ac code
class Solution:
def matchReplacement(self, s: str, sub: str, mappings: List[List[str]]) -> bool:
n, m = len(s), len(sub)
mySet = set()
for x, y in mappings:
mySet.add((x, y))
#print(myDict)
for i in range(n - m + 1):
cankao = s[i: i + m]
#print(cankao)
flag = True
for j in range(m):
if sub[j] != cankao[j] and (sub[j], cankao[j]) not in mySet:
flag = False
break
if flag:
return True
return False
summary
Simple set
边栏推荐
- C language practice (4) -- multiplication and division of large numbers
- How to download Vega in China
- Review of MySQL (VIII): Transactions
- 2022.6.12-----leetcode.890
- 基于Halcon的螺栓螺丝部分划痕、腐蚀缺陷检测
- lua记录
- 309. the best time to buy and sell stocks includes the freezing period
- To understand Devops, you must read these ten books!
- Problems that the sap Spartacus e-commerce cloud UI shipping method does not display in the unit test environment
- 觀察網站的頁面
猜你喜欢

liunx部署Seata(Nacos版)

kali局域网ARP欺骗(arpspoof)并监听(mitmproxy)局域内其它主机上网记录

kali2022如何安装w3af

基于Halcon的矩形卡片【手动绘制ROI】的自由测量

C language practice (4) -- multiplication and division of large numbers

收获满满的下午

Analyzing mobx responsive refresh mechanism from source code

MySQL advanced learning notes

Quickly copy the request in browser F12 to postman/ or generate the corresponding code of the relevant language

C language operation database (SQLite3) call interface function
随机推荐
GD32F4xx控制DGUS 变量显示
Voir les pages du site
用一个性能提升了666倍的小案例说明在TiDB中正确使用索引的重要性
基于STM32设计智能家居控制系统(OneNet)_2022
Title 68: there are n integers, so that the previous numbers are moved backward m positions, and the last m numbers become the first m numbers
快速复制浏览器F12中的请求到Postman/或者生成相关语言的对应代码
The difference between user status and system status in CRM
每日一博 - 微服务权限一二事
VirtualLab基础实验教程-4.单缝衍射
基于halcon—缺陷检测常用方法与示例总结
232-CH579M学习开发-以太网例程-TCP服务器(项目应用封装,局域网或广域网测试)
The Bean Validation API is on the classpath but no implementation could be found
Order allocation strategy for instant delivery: from modeling and Optimization - Notes
kali局域网ARP欺骗(arpspoof)并监听(mitmproxy)局域内其它主机上网记录
tarfile解压嵌套tar
机器学习在美团配送系统的实践:用技术还原真实世界-笔记
Research Report on the overall scale, major manufacturers, major regions, products and application segmentation of swimming fins in the global market in 2022
Review of MySQL (4): sorting operation
Two months later, my second listing anniversary [June 2, 2022]
从应无所住说起