当前位置:网站首页>2022.6.12-----leetcode. eight hundred and ninety
2022.6.12-----leetcode. eight hundred and ninety
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];// Storage pattern For each word Letters in
out:for(String word:words){
Arrays.fill(map,-1);
int mark=1<<26;// Mark the mapped word Letter
for(int j=0;j<pattern.length();j++){
//pattern Letters have no mapping
if(map[pattern.charAt(j)-'a']==-1){
if((mark&(1<<(word.charAt(j)-'a')))!=0)// Judge word Whether the letters have been mapped
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')// Judge pattern Whether to map the same letter
continue out;
}
}
ans.add(word);
}
return ans;
}边栏推荐
- Basic SQL statement - select (single table query)
- USB to serial port - serial port driver type
- C language operation database (SQLite3) call interface function
- Stream flow precautions
- Eve-ng installation (network device simulator)
- Strings in JS (including leetcode examples) < continuous update ~>
- GD32F4xx控制DGUS触控按键
- Summary of static memory allocation and dynamic memory allocation
- leetcode 647. Palindrome substring
- Pytest automated testing framework (II)
猜你喜欢

Review of MySQL (3): query operation

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?

Global lock, table lock, row lock

VirtualLab基础实验教程-4.单缝衍射

USB to serial port - maximum peak serial port baud rate vs maximum continuous communication baud rate

C brief introduction

es7不使用父子和嵌套关系来实现一对多功能

Explanation of core interrupt of Godson processor

LCD parameter interpretation and calculation
随机推荐
Gospel of audio and video developers, rapid integration of AI dubbing capability
js判断回文数
Machine learning series (5): Naive Bayes
Analyzing mobx responsive refresh mechanism from source code
C语言练习(4)——大数乘除
【sql语句基础】——查(select)(单表查询)
联想回应笔记本太多太杂乱:现在是产品调整期 未来将分为数字/Air/ Pro三大系列
MIPS general purpose register + instruction
Relationship between resolution and line field synchronization signal
GD32F4xx控制DGUS触控按键
JS judge palindromes
Basic SQL statement - select (single table query)
Global lock, table lock, row lock
Write a select based concurrent server
279. perfect square
JS dichotomy
leetcode 647. Palindrome substring
迄今微软不同时期发布的SQL Server各版本之间的大致区别,供参考查阅
Is it safe to open an account in flush
USB to serial port - maximum peak serial port baud rate vs maximum continuous communication baud rate