当前位置:网站首页>2022.6.12 - leetcode. 89.
2022.6.12 - leetcode. 89.
2022-06-12 18:23:00 【Lu 727】
public List<String> findAndReplacePattern(String[] words, String pattern) {
List<String> ans=new ArrayList<>();
int n=words.length;
int[] map=new int[26];//StockagepatternCorrespond à chaquewordLes lettres de
out:for(String word:words){
Arrays.fill(map,-1);
int mark=1<<26;//Étiquette déjà cartographiéewordLettres
for(int j=0;j<pattern.length();j++){
//patternLes lettres ne sont pas cartographiées
if(map[pattern.charAt(j)-'a']==-1){
if((mark&(1<<(word.charAt(j)-'a')))!=0)//JugementwordSi les lettres ont été cartographiées
continue out;
map[pattern.charAt(j)-'a']=word.charAt(j)-'a';
mark|=1<<(word.charAt(j)-'a');
}else{
if(map[pattern.charAt(j)-'a']!=word.charAt(j)-'a')//Jugementpattern Si la même lettre est cartographiée
continue out;
}
}
ans.add(word);
}
return ans;
}
边栏推荐
- High speed layout guidelines incomplete
- js将数组中的0移动到末尾
- C#简单介绍
- Gd32f4xx communicates with electric energy meter conforming to dlt645_ two
- General differences between SQL server versions released by Microsoft in different periods so far, for reference
- Shenzhen has been shut down for 7 days since March 14. Home office experience | community essay solicitation
- NixOS 22.05安装过程记录
- Analyzing mobx responsive refresh mechanism from source code
- leetcode 300. Longest increasing subsequence
- Reconstruction -- sort out and decompose the inheritance system
猜你喜欢
Solution to the problem that the anaconda navigator card logo cannot be opened and the card will flash back - replace the alicloud image source
有源差分晶振原理圖以及LV-PECL、LVDS、HCSL區別
Overall flow chart of kernel interrupt
【sql语句基础】——查(select)(单表查询)
ES7 does not use parent-child and nested relationships to implement one to many functions
Window版本pytorch入门深度学习环境安装与配置
Pytest automated testing framework (II)
Gospel of audio and video developers, rapid integration of AI dubbing capability
Title 54: take 4 ~ 7 bits of an integer a from the right end.
有源差分晶振原理图以及LV-PECL、LVDS、HCSL区别
随机推荐
Changes in the third generation dri
Random talk about redis source code 90
面试题总结
在同花顺开户证券安全吗
Lambda - 1
Title 54: take 4 ~ 7 bits of an integer a from the right end.
01-复杂度
Is it safe to open an account in flush
机器学习系列(5):朴素贝叶斯
Mise en œuvre de l'ACL réflexe dans le simulateur Cisco Cisco Packet Tracer
Arrays in JS (including leetcode examples) < continuous update ~>
Topic 66: input array, exchange the largest element with the first element, exchange the smallest element with the last element, and output array.
VirtualLab基础实验教程-6.闪耀光栅
迄今微软不同时期发布的SQL Server各版本之间的大致区别,供参考查阅
Self made calculator (1 realized by Boolean logic operation unit and control unit programming)
Eve-ng installation (network device simulator)
TypeScript常用类型(一)
Window版本pytorch入门深度学习环境安装与配置
JS dichotomy
C#简单介绍