【Leetcode_easy】804. Unique Morse Code Words
problem
solution1:
class Solution {
public:
int uniqueMorseRepresentations(vector<string>& words) {
vector<string> morse{".-", "-...","-.-.","-..",".","..-.","--.","....","..",".---","-.-",".-..","--","-.","---",".--.","--.-",".-.","...","-","..-","...-",".--","-..-","-.--","--.."};
unordered_set<string> s;//err..
for(auto word:words)
{
string t = "";
for(auto ch:word)
{
t += morse[ch-'a'];//errr...
}
s.insert(t);
}
return s.size();
}
};
参考
1. Leetcode_easy_804. Unique Morse Code Words;
2. Grandyang;
完
【Leetcode_easy】804. Unique Morse Code Words的更多相关文章
- 【Leetcode】804. Unique Morse Code Words
Unique Morse Code Words Description International Morse Code defines a standard encoding where each ...
- 【LeetCode】804. Unique Morse Code Words 解题报告(Python)
作者: 负雪明烛 id: fuxuemingzhu 个人博客: http://fuxuemingzhu.cn/ 目录 题目描述: 题目大意 解题方法 set + map set + 字典 日期 题目地 ...
- 804. Unique Morse Code Words - LeetCode
Question 804. Unique Morse Code Words [".-","-...","-.-.","-..&qu ...
- Leetcode 804. Unique Morse Code Words 莫尔斯电码重复问题
参考:https://blog.csdn.net/yuweiming70/article/details/79684433 题目描述: International Morse Code defines ...
- (string 数组) leetcode 804. Unique Morse Code Words
International Morse Code defines a standard encoding where each letter is mapped to a series of dots ...
- 804. Unique Morse Code Words
Description International Morse Code defines a standard encoding where each letter is mapped to a se ...
- LeetCode - 804. Unique Morse Code Words
International Morse Code defines a standard encoding where each letter is mapped to a series of dots ...
- LeetCode 804 Unique Morse Code Words 解题报告
题目要求 International Morse Code defines a standard encoding where each letter is mapped to a series of ...
- [LeetCode] 804. Unique Morse Code Words_Easy tag: Hash Table
International Morse Code defines a standard encoding where each letter is mapped to a series of dots ...
随机推荐
- Java锁--Semaphore
转载请注明出处:http://www.cnblogs.com/skywang12345/p/3534050.html Semaphore简介 Semaphore是一个计数信号量,它的本质是一个&quo ...
- Apicloud 之按两次后退键退出应用
api.addEventListener({ name: 'keyback' }, function(ret, err) { if (flag == 1) { api.closeWidget({ si ...
- div 里面内容水平垂直居中
css .main{ background: #999999; width: 600px; height: 400px; /*采用flex方式*/ display: flex; /*div内容垂直居中 ...
- 利用Intellij+MAVEN搭建Spring+Mybatis+MySql+SpringMVC项目详解
http://blog.csdn.net/noaman_wgs/article/details/53893948 利用Intellij+MAVEN搭建Spring+Mybatis+MySql+Spri ...
- 081_使用 awk 编写的 wc 程序
#!/bin/bash#自定义变量 chars 变量存储字符个数,自定义变量 words 变量存储单词个数#awk 内置变量 NR 存储行数#length()为 awk 内置函数,用来统计每行的字符数 ...
- 利用 BackgroundService 固定时间间隔执行某动作
继承 BackgroundService 类: 为什么会写这个东西呢?本人在写消息队列的时候思考过一个问题——比如,每5秒从队列里面取一条消息(一条消息里面又包含了1000条数据),要把这1000条数 ...
- Spring注解不生效
如果在使用spring中,发现注解不生效,检查下如下配置是否配置. 1:一般情况下@Autowired默认是不生效的,配置之后,才会生效 <context:annotation-config / ...
- Bsgs模板
模板最主要的是自己看得舒服,不会给自己留隐患,调起来比较简单,板子有得是,最主要的是改造出适合你的那一套. ——mzz #include<bits/stdc++ ...
- netcore 发布到IIS上常见错误
1 出现AspNetCoreModuleV2错误 报错原因: 你的IIS服务器上的.net core 运行时不是最新的,导致AspNetCoreModuleV2模块缺失或者报错,意思需要你更新了! 2 ...
- 2018-2019-2 20165234 《网络对抗技术》 Exp7 网络欺诈防范
Exp7 网络欺诈防范 实验内容 1. 简单应用SET工具建立冒名网站 2. ettercap DNS spoof 3. 结合应用两种技术,用DNS spoof引导特定访问到冒名网站 4. 请勿使用 ...