当前位置:网站首页>2022.07.03 (LC 6108 decryption message)
2022.07.03 (LC 6108 decryption message)
2022-07-05 00:14:00 【Leeli9316】
Method : simulation
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);
}
}
边栏推荐
- P4408 [NOI2003] 逃学的小孩(树的直径)
- Pytoch --- use pytoch to realize linknet for semantic segmentation
- TS快速入门-函数
- 巩固表达式C# 案例简单变量运算
- (script) one click deployment of any version of redis - the way to build a dream
- [kotlin] the third day
- Paddleocr tutorial
- Business implementation - the log is written to the same row of data
- Is it safe to open an account in the College of Finance and economics? How to open an account?
- Basic points of the game setup of the points mall
猜你喜欢
ORB(Oriented FAST and Rotated BRIEF)
IELTS examination process, what to pay attention to and how to review?
如何有效对直流列头柜进行监测
【路径规划】RRT增加动力模型进行轨迹规划
快解析内网穿透帮助企业快速实现协同办公
Hong Kong Jewelry tycoon, 2.2 billion "bargain hunting" Giordano
[论文阅读] CarveMix: A Simple Data Augmentation Method for Brain Lesion Segmentation
企业公司项目开发好一部分基础功能,重要的事保存到线上第一a
P3304 [sdoi2013] diameter (diameter of tree)
Continuous modification of business scenario functions
随机推荐
Hong Kong Jewelry tycoon, 2.2 billion "bargain hunting" Giordano
Mit-6.824-lab4b-2022 (10000 word idea explanation - code construction)
JS how to realize array to tree
挖财学院开户安全的吗?开户怎么开?
【selenium自动化】常用注解
GDB常用命令
电力运维云平台:开启电力系统“无人值班、少人值守”新模式
Data on the number of functional divisions of national wetland parks in Qinghai Province, data on the distribution of wetlands and marshes across the country, and natural reserves in provinces, cities
Application of multi loop instrument in base station "switching to direct"
Go pit - no required module provides Package: go. Mod file not found in current directory or any parent
TS快速入门-函数
Acwing164. Accessibility Statistics (topological sorting +bitset)
How to avoid arc generation—— Aafd fault arc detector solves the problem for you
Enterprise application business scenarios, function addition and modification of C source code
Summer challenge brings you to play harmoniyos multi terminal piano performance
Introduction to ACM combination counting
[论文阅读] TUN-Det: A Novel Network for Thyroid Ultrasound Nodule Detection
Date time type and format in MySQL
Application of fire fighting system based on 3D GIS platform
【北京大学】Tensorflow2.0-1-开篇