当前位置:网站首页>Not for 60 days, magical dictionary
Not for 60 days, magical dictionary
2022-07-29 04:16:00 【A little Ming】
class MagicDictionary {
private String[] words;
public MagicDictionary() {
}
public void buildDict(String[] dictionary) {
words = dictionary;
}
public boolean search(String searchWord) {
for (String word : words) {
if (word.length() != searchWord.length()) {
continue;
}
int diff = 0;
for (int i = 0; i < word.length(); ++i) {
if (word.charAt(i) != searchWord.charAt(i)) {
++diff;
if (diff > 1) {
break;
}
}
}
if (diff == 1) {
return true;
}
}
return false;
}
}
author :LeetCode-Solution
link :https://leetcode.cn/problems/US1pGT/solution/shen-qi-de-zi-dian-by-leetcode-solution-uvh3/
source : Power button (LeetCode)
The copyright belongs to the author . Commercial reprint please contact the author for authorization , Non-commercial reprint please indicate the source .
边栏推荐
猜你喜欢
Machine vision Series 1: Visual Studio 2019 dynamic link library DLL establishment
不会就坚持69天吧 合并区间
14.haproxy+keepalived负载均衡和高可用
MySQL gets the maximum value record by field grouping
Why are there so many unknowns when opengauss starts?
The principle of inverse Fourier transform (IFFT) in signal processing
Locally call tensorboard and Jupiter notebook on the server (using mobaxterm)
Install the laser of ROS_ scan_ Problems encountered in match library (I)
Mmdetection preliminary use
[kvm] create virtual machine from kickstart file
随机推荐
Compilation and linking
Semantic segmentation correlation
Pointer variables -printf%d and%p meaning
How to execute insert into select from job in SQL client
"Weilai Cup" 2022 Niuke summer multi school training camp 1 J serval and essay (heuristic merger)
STM32F103ZET6程序移植为C8T6+C8T6下载程序flash timeout的解决方案
The solution of porting stm32f103zet6 program to c8t6+c8t6 download program flash timeout
索引的最左前缀原理
“蔚来杯“2022牛客暑期多校训练营2 H
Interview notes of a company
2021 sist summer camp experience + record post of School of information, Shanghai University of science and technology
Why do I delete the original record (OP d) and then add a new one in Kafka when I update MySQL data
Codeforces round 810 (Div. 2) d. rain (segment tree difference)
Function pointer and callback function
Blood cases caused by < meta charset=UTF-8> -- Analysis of common character codes
Beginner: array & String
数据集成这个地方的过滤条件该咋写,用的啥语法?sql语法处理bizdate可以不
MySQL gets the maximum value record by field grouping
Is the array name a pointer
MPU6050