当前位置:网站首页>2022.07.03(LC_6108_解密消息)
2022.07.03(LC_6108_解密消息)
2022-07-05 00:08:00 【Leeli9316】
方法:模拟
class Solution {
public String decodeMessage(String key, String message) {
Map<Character, Character> map = new HashMap<>();
char c = 'a';
for (char ch : key.replace(" ", "").toCharArray()) {
if (!map.containsKey(ch)) {
map.put(ch, c++);
}
}
char[] m = message.toCharArray();
for (int i = 0; i < m.length; i++) {
if (m[i] != ' ') {
m[i] = map.get(m[i]);
}
}
return new String(m);
}
}
边栏推荐
猜你喜欢
S32 design studio for arm 2.2 quick start
IELTS examination process, what to pay attention to and how to review?
基于三维gis平台的消防系统运用
[IELTS reading] Wang Xiwei reading P4 (matching1)
Combien de temps faut - il pour obtenir un certificat PMP?
How to use fast parsing to make IOT cloud platform
Microservice
The input of uniapp is invalid except for numbers
同事的接口文档我每次看着就头大,毛病多多。。。
Parsing of XML
随机推荐
How many triangles are there in the golden K-line diagram?
[JS] - [dynamic planning] - Notes
华为200万年薪聘请数据治理专家!背后的千亿市场值得关注
abc 258 G - Triangle(bitset)
Continuous modification of business scenario functions
圖解網絡:什麼是網關負載均衡協議GLBP?
XML的解析
PMP certificate renewal process
[monitoring] ZABBIX
【报错】 “TypeError: Cannot read properties of undefined (reading ‘split‘)“
The pit of sizeof operator in C language
Instructions for go defer
【雅思阅读】王希伟阅读P3(Heading)
[Peking University] tensorflow2.0-1-opening
巩固表达式C# 案例简单变量运算
Using fast parsing intranet penetration to realize zero cost self built website
What is the difference between port mapping and port forwarding
Skills in analyzing the trend chart of London Silver
Introduction to ACM combination counting
Fast parsing intranet penetration helps enterprises quickly achieve collaborative office