mycode   71.97%

class Solution(object):
def isAnagram(self, s, t):
"""
:type s: str
:type t: str
:rtype: bool
"""
s = sorted(s)
t = sorted(t)
return s == t

参考

class Solution(object):
def isAnagram(self, s, t):
"""
:type s: str
:type t: str
:rtype: bool
"""
return all([s.count(c) == t.count(c) for c in string.ascii_lowercase])

用法

leetcode-easy-string-242. Valid Anagram的更多相关文章

  1. [LeetCode&Python] Problem 242. Valid Anagram

    Given two strings s and t , write a function to determine if t is an anagram of s. Example 1: Input: ...

  2. 【leetcode❤python】242. Valid Anagram

    class Solution(object):    def isAnagram(self, s, t):        if sorted(list(s.lower()))==sorted(list ...

  3. 22. leetcode 242. Valid Anagram(由颠倒字母顺序而构成的字)

    22. 242. Valid Anagram(由颠倒字母顺序而构成的字) Given two strings s and t, write a function to determine if t i ...

  4. LN : leetcode 242 Valid Anagram

    lc 242 Valid Anagram 242 Valid Anagram Given two strings s and t, write a function to determine if t ...

  5. 242. Valid Anagram(C++)

    242. Valid Anagram Given two strings s and t, write a function to determine if t is an anagram of s. ...

  6. 【LeetCode】242. Valid Anagram (2 solutions)

    Valid Anagram Given two strings s and t, write a function to determine if t is an anagram of s. For ...

  7. [leetcode]242. Valid Anagram验证变位词

    Given two strings s and t , write a function to determine if t is an anagram of s. Example 1: Input: ...

  8. (easy)LeetCode 242.Valid Anagram

    Given two strings s and t, write a function to determine if t is an anagram of s. For example,s = &q ...

  9. 【LeetCode】242. Valid Anagram 解题报告(Java & Python)

    作者: 负雪明烛 id: fuxuemingzhu 个人博客: http://fuxuemingzhu.cn/ 目录 题目描述 题目大意 字典统计词频 排序 日期 [LeetCode] 题目地址:ht ...

  10. 【一天一道LeetCode】#242. Valid Anagram

    一天一道LeetCode 本系列文章已全部上传至我的github,地址:ZeeCoder's Github 欢迎大家关注我的新浪微博,我的新浪微博 欢迎转载,转载请注明出处 (一)题目 Given t ...

随机推荐

  1. snappy-java两种压缩方式的区别

    1.Snappy-java项目地址 https://github.com/xerial/snappy-java 2.Snappy-java两种压缩方式 使用Snappy.compress进行压缩 St ...

  2. python 目录管理与文件管理

    目录管理(os) system:执行系统命令 # 执行系统命令 os.system('cls') name:获取操作系统名称 # 操作系统名称,nt代表Windows, posix代表类unix pr ...

  3. 好用的 python 工具集合

    图标处理小程序, 妈妈再也不用担心我不会制作图标了 # PythonMargick包可以到Unofficial Windows Binaries for Python Extension Packag ...

  4. TensorFlow入门——安装

    由于实验室新配了电脑,旧的电脑就淘汰下来不用,闲来无事,就讲旧的电脑作为个人的工作站来使用. 由于在旧电脑上安装的是Ubuntu 16.04 64bit系统,系统自带的是Python 2.7,版本选择 ...

  5. wordcloud:让你的词语变成黑云

    介绍 对文本中出现频率较高的关键词给予视觉化的显示 使用 import jieba import codecs import wordcloud file = r"C:\Users\Admi ...

  6. deep_learning_Function_tf.identity()

    这两天看batch normalization的代码时,学到滑动平均窗口函数ExponentialMovingAverage时,碰到一个函数tf.identity()函数,特此记录. tf.ident ...

  7. swoole如何在后台运行

    swoole如何在后台运行 nohup php server.php &

  8. 移远模组-BC95-工作模式之间关系

    三种连接状态下,均可发送上行数据( CoAP/UDP): IDLE 下发送数据, 模块会进入 CONNECT 状态: PSM 下发送是数据会唤醒模块, 进入 CONNECT,或者当 TAU(TAU 的 ...

  9. Java语言基础(4)

    1 关系运算符:>,>=,<,<=,==,!= 案例:Demo1 public class Demo1 { //偶数:能被2整除的整数 //2,4,6,8,10... //整除 ...

  10. HihoCoder1336 Matrix Sum(二维树状数组求和)

    时间限制:10000ms 单点时限:1000ms 内存限制:256MB 描述 You are given an N × N matrix. At the beginning every element ...