当前位置:网站首页>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);
}
}
边栏推荐
- abc 258 G - Triangle(bitset)
- 「运维有小邓」域密码策略强化器
- GDB common commands
- Cross domain request
- uniapp微信小程序拿来即用的瀑布流布局demo2(方法二)(复制粘贴即可使用,无需做其他处理)
- Build your own minecraft server with fast parsing
- 用快解析内网穿透实现零成本自建网站
- Mit-6.824-lab4b-2022 (10000 word idea explanation - code construction)
- 如何有效对直流列头柜进行监测
- 快解析内网穿透帮助企业快速实现协同办公
猜你喜欢
「运维有小邓」域密码策略强化器
In June, the list of winners of "Moli original author program" was announced! Invite you to talk about the domestic database
Design of emergency lighting evacuation indication system for urban rail transit station
使用快解析搭建自己的minecraft服务器
基本放大电路的学习
JS how to realize array to tree
[IELTS reading] Wang Xiwei reading P3 (heading)
他做国外LEAD,用了一年时间,把所有房贷都还清了
Mit-6.824-lab4b-2022 (10000 word idea explanation - code construction)
Acrel-EMS综合能效平台在校园建设的意义
随机推荐
GDB common commands
【路径规划】RRT增加动力模型进行轨迹规划
模板的进阶
Hologres Query管理及超时处理
abc 258 G - Triangle(bitset)
Basic points of the game setup of the points mall
Get to know ROS for the first time
OpenHarmony资源管理详解
How to save your code works quickly to better protect your labor achievements
TS快速入门-函数
In June, the list of winners of "Moli original author program" was announced! Invite you to talk about the domestic database
微服务(Microservice)那点事儿
如果炒股开华泰证券的户,在网上开户安全吗?
基本放大电路的学习
The waterfall flow layout demo2 (method 2) used by the uniapp wechat applet (copy and paste can be used without other processing)
多回路仪表在基站“转改直”方面的应用
Is the account opening link of Huatai Securities with low commission safe?
Business implementation - the log is written to the same row of data
go踩坑——no required module provides package : go.mod file not found in current directory or any parent
城市轨道交通站应急照明疏散指示系统设计