博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Leetcode Array知识点总结
阅读量:4221 次
发布时间:2019-05-26

本文共 596 字,大约阅读时间需要 1 分钟。

  • :统计单词翻译成摩斯电码后摩斯电码的个数,Easy

set

class Solution(object):    def uniqueMorseRepresentations(self, words):        """        :type words: List[str]        :rtype: int        """        tables = [".-","-...","-.-.","-..",".","..-.","--.","....","..",                  ".---","-.-",".-..","--","-.","---",".--.","--.-",".-.",                  "...","-","..-","...-",".--","-..-","-.--","--.."]        sets = set([])        for word in words:            ret = ''            for token in word:                ret+=tables[ord(token)-ord('a')]            sets.add(ret)        return len(sets)

to be continue

转载地址:http://bbqmi.baihongyu.com/

你可能感兴趣的文章
corosync pacemaker 配置高可用集群(一)
查看>>
5种IO模型、阻塞IO和非阻塞IO、同步IO和异步IO
查看>>
nginx(一) nginx详解
查看>>
nginx(二) nginx编译安装 及 配置WEB服务
查看>>
nginx(三) nginx配置:反向代理 负载均衡 后端健康检查 缓存
查看>>
nginx(四) nginx+keepalived 实现主备+双主热备模型的高可用负载均衡代理服务
查看>>
jQuery核心--多库共存
查看>>
QTP Tutorial #23 – QTP Smart Object Identification, Sync Point, and Test Result Analysis
查看>>
第一章漫话自动化测试
查看>>
第二章:Selenium IDE应用实践
查看>>
第三章:Python基础
查看>>
正则表达式
查看>>
第五章 自动化测试模型
查看>>
Linux命令行与shell编程第3章基本的shell
查看>>
Linux命令行与shell编程第4章 更多的bash shell命令
查看>>
4 51 单片机最小系统
查看>>
6 51点亮第一个LED
查看>>
8 51 LED流水灯
查看>>
Multisim 14.0 搭建并仿真51单片机最小系统
查看>>
51 中断系统 外部中断0 外部中断1
查看>>