Leetcode 804. Unique Morse Code Words

Posted 周洋的Blog

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Leetcode 804. Unique Morse Code Words相关的知识,希望对你有一定的参考价值。

class Solution:
    def uniqueMorseRepresentations(self, words):
        lib = [".-", "-...", "-.-.", "-..", ".", "..-.", "--.", "....", "..", ".---", "-.-", ".-..", "--", "-.", "---",
               ".--.", "--.-", ".-.", "...", "-", "..-", "...-", ".--", "-..-", "-.--", "--.."]
        return len({‘‘.join(lib[ord(c) - ord(a)] for c in word) for word in words})

 

以上是关于Leetcode 804. Unique Morse Code Words的主要内容,如果未能解决你的问题,请参考以下文章

leetcode-804-Unique Morse Code Words

LeetCode 804 Unique Morse Code Words 解题报告

Leetcode 804. Unique Morse Code Words

[LeetCode] 804. Unique Morse Code Words 独特的摩斯码单词

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

算法leetcode每日一练804. 唯一摩尔斯密码词