【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 ...
随机推荐
- KM 最大权匹配 UVA 1411/POJ 3565
#include <bits/stdc++.h> using namespace std; inline void read(int &num) { char ch; num = ...
- bootstrap之collapse
<div class="container"> <!--该button可以控制div是否显示 1.首先给button设置data-toggle="col ...
- 关于Maven打包
Maven打包构建完全指南和最佳实践 Maven最佳实践:划分模块 IDEA一个项目引用另一个项目 IDEA创建多个模块MavenSpringBoot项目 这个简单明了,基础知识
- firewall 相关命令
1.firewalld的基本使用 启动: systemctl start firewalld 查看状态: systemctl status firewalld 停止: systemctl disabl ...
- (1)打鸡儿教你Vue.js
当今世界不会Vue.js,前端必定路难走 一个JavaScript MVVM库 以数据驱动和组件化的思想构建的 Vue.js是数据驱动 HTML/CSS/JavaScript/ES6/HTTP协议/V ...
- 经常用到(创建OS)的命令
1. 将汇编代码编译为二进制模块文件 nasm mbr.asm -o mbr nasm loader.asm -o loader 2. 将wirte.c ...
- shiro 配置注解后无权访问不进行页面跳转异常:org.apache.shiro.authz.UnauthorizedException: Subject does not have permission
该问题需要使用异常管理: <!-- 无权访问跳转的页面 --> <bean class="org.springframework.web.servlet.handler.S ...
- 用python实现不同格式99乘法表输出
前言:学习python已经有一段时间了,最近发现有时候会出现一个东西知道,也能写出来,但是说不出来的情况.思考后觉得是基础还不够扎实,只一味写代码,没有深入思考具体实现的逻辑,以及各个点之间的关联.所 ...
- Hadoop hadoop的介绍和几种模式
Hadoop简介 Hadoop软件库是一个开源框架,允许使用简单的编程模型跨计算机集群分布式处理大型数据集.它旨在从单个服务器扩展到数千台计算机,每台计算机都提供本地计算和存储.库本身不是依靠硬件来提 ...
- ansible user模块
查看模块的功能和选项,使用ansible-doc命令 ansible-doc options: -l #查看所有可用的模块 -m #查看模块的路径 -v #查看版本 -t TYPE #查看插件,插件: ...