【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 ...
随机推荐
- Spring MVC 学习笔记(二)
6. 视图和视图解析器 ❤ Spring MVC如何解析视图 • 请求处理方法执行完成后,最终返回一个ModelAndView对象 ...
- MySQL5.7版本安装(压缩包形式)
1.去官网下载 MySQL 压缩包 2.配置环境变量 3.创建配置文件my.ini (放置 mysql-5.7.28-winx64 目录下) my.ini 配置文件 编写如下内容 [client] p ...
- BZOJ 2699: 更新 (DP)
题目 对于一个数列A[1-N],一种寻找最大值的方法是:依次枚举A[2]到A[N],如果A[i]比当前的A[1]值要大,那么就令A[1]=A[i],最后A[1]为所求最大值.假设所有数都在范围[1, ...
- C++类*类型和其他类型相互转换
类类型转换时会出现两种之间转换,下面我们说的是类类型 1.其他类型转换为本类类型 通过类带一个参数的构造函数:或者多个参数构造函数,除了第一个参数后面参数都有默认值时!这样在其他类型赋值给该类类型对象 ...
- P1986 元旦晚会——贪心或差分约束系统
P1986 元旦晚会 每个人可能属于不同的声部,每个声部最少要有c[i]个人发声: 求最少需要多少话筒: 首先贪心,将所有声部的区间按照右端点大小排序,如果右端点相同,左端点从小到大排序: 贪心每次选 ...
- 用Python匹配HTML tag的时候,<.>和<.?>有什么区别?
答:术语叫贪婪匹配( <.> )和非贪婪匹配(<.?> ) 例如: test <.*> : test <.*?> :
- 2019-06-03 校内python模拟题解(所有非原题)
一起来女装吧 本题改编自USACO(USA Computing Olympiad) 1.1节的第一题 (感谢lsy同学对本题题面的贡献) 直接计算就好了 chr:将ASCII码转成字符 ord:字符对 ...
- 正确处理listview的position
当ListView包含有HeaderView或FooterView时,传入getView或者onItemClick的position是怎样的,这是个值得探讨的问题 先列出错误的用法 定义: priva ...
- Linux单独打包工具-Ubuntu
Electron-Packager 使用electron-packager打包:https://github.com/electron/electron-packagerelectron-packag ...
- IIS/VS IIS Express 添加MIME映射 svg、woff、woff2、json
出现问题 页面提示 font-awesome/fonts/fontawesome-webfont.woff2?v=4.3.0 Failed to load resource: the server r ...