problem

804. Unique Morse Code Words

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的更多相关文章

  1. 【Leetcode】804. Unique Morse Code Words

    Unique Morse Code Words Description International Morse Code defines a standard encoding where each ...

  2. 【LeetCode】804. Unique Morse Code Words 解题报告(Python)

    作者: 负雪明烛 id: fuxuemingzhu 个人博客: http://fuxuemingzhu.cn/ 目录 题目描述: 题目大意 解题方法 set + map set + 字典 日期 题目地 ...

  3. 804. Unique Morse Code Words - LeetCode

    Question 804. Unique Morse Code Words [".-","-...","-.-.","-..&qu ...

  4. Leetcode 804. Unique Morse Code Words 莫尔斯电码重复问题

    参考:https://blog.csdn.net/yuweiming70/article/details/79684433 题目描述: International Morse Code defines ...

  5. (string 数组) leetcode 804. Unique Morse Code Words

    International Morse Code defines a standard encoding where each letter is mapped to a series of dots ...

  6. 804. Unique Morse Code Words

    Description International Morse Code defines a standard encoding where each letter is mapped to a se ...

  7. LeetCode - 804. Unique Morse Code Words

    International Morse Code defines a standard encoding where each letter is mapped to a series of dots ...

  8. LeetCode 804 Unique Morse Code Words 解题报告

    题目要求 International Morse Code defines a standard encoding where each letter is mapped to a series of ...

  9. [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 ...

随机推荐

  1. msaa mrt load store action unity

    unity buildin renderpipeline 和lightweight rp 对于开了msaa的rt 的load store action设置失效 buildin的时候set render ...

  2. mysql双主模式方案

    MySQL双主(主主)架构方案   在企业中,数据库高可用一直是企业的重中之重,中小企业很多都是使用mysql主从方案,一主多从,读写分离等,但是单主存在单点故障,从库切换成主库需要作改动.因此,如果 ...

  3. Inellij idea创建javaWeb以及Servlet简单实现

    版权声明:本文为博主原创文章,未经博主允许不得转载. 准备:1. 安装jdk1.7 2. 安装tomcat1.8 一.创建并设置javaweb工程 1.创建javaweb工程File --> N ...

  4. CSS 布局和 BFC

    什么是 BFC 在一个Web页面的CSS渲染中,块级格式化上下文 (Block Fromatting Context)是按照块级盒子布局的.W3C对BFC的定义如下:浮动元素和绝对定位元素,非块级盒子 ...

  5. iwap:修改菜单树文件

    1.添加mysql数据库连接的jar包. 2.

  6. Mokia 摩基亚

    题目链接:[https://www.luogu.com.cn/problem/P4390] 快捷版题意: 维护一个\(W*W\)的矩阵,初始值均为\(S\).每次操作可以增加某格子的权值,或询问某子矩 ...

  7. Redis学习之一--基础知识

    一.定义 REmote DIctionary Server(Redis) 是一个以字典结构存储数据的key-value存储系统:使用ANSI C语言编写.遵守BSD协议.支持网络.可基于内存亦可持久化 ...

  8. linux环境下完成jenkins的环境搭建

    环境搭建部署: 请完成jenkins的环境搭建,需安装tomcat,mysql. Jenkins 地址:  https://jenkins.io/download/ 步骤分析: 1.全部操作使用普通用 ...

  9. sqlserver 两 表 数据 复制 (附加 跨服务器 查询的方法)

    一 : 这个sql 语句 可以快速的 将 一 个旧表 中的指定字段的数据 复制到 另一个新表的指定字段中 insert into dbo.Customer ( CustomerId , Custome ...

  10. hive --metastore三种模式

    在官网上对于这几种模式的介绍如下: 按Metastore数据库位置分: 1.本地/嵌入式Metastore数据库(Derby) 2.远程Metastore数据库(其他的关系型数据库,像mysql.or ...