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. weex 通用样式以及需要注意的问题

    一.说明 weex 对于 css 样式的支持是非常有限的,并且使用样式的时候,必须遵循 weex 定义的规则. 对于不遵循 weex 样式规则的代码,往往在 web 页面上有效,而在 native 环 ...

  2. Spring Boot整合dubbo(注解的方式)

    一.创建项目 1.创建一个空的项目 2.在空的项目中添加两个Spring Boot模块,如下图所示 二.在provider模块中的pom文件中添加依赖 <dependency> <g ...

  3. Linux排查磁盘空间顺序解决空间不足问题

    1 先查看整个磁盘的情况 df    -h                     查看整台服务器的硬盘使用情况 cd    /                       进入根目录 du   -s ...

  4. 2019-2020-1 20199319《Linux内核原理与分析》第四周作业

    MenuOS的构造 基础知识 1.操作系统的两把宝剑:①中断上下文的切换:保存现场和恢复现场:②进程上下文的切换. 2.Linux内核以A.B.C.D方式命名:A和B变得无关紧要,C是内核的真实版本, ...

  5. Centos 7安装部署zabbix 3.0LTS

    1.环境准备 OS:CentOS 7.2 64bit Zabbix版本:3.0.12 MySQL版本:5.6 注意:zabbix3.0相关要求 mysql5.0以上版本.apache1.3以上版本.p ...

  6. Windows 10安装Python 2.7和MySQL-python

    1. 安装Python Download Python 2. 安装MySQL-python pip install wheel (应该是可选) pip install mysqlclient==1.3 ...

  7. 软件测试 基础 (三) (web 页面常见功能测试)

    web 页面中 四种常见 必测控件 输入框 1.为空 (如果不为空,页面有“*”号标注,或者只有一个输入框) a.没有任何输入,焦点离开有提示,提交页面无跳转 仍有提示 b.输入一个或多个空格,焦点离 ...

  8. 有关List、Set、Map的基础了解

           刚申请了一个博客,怀着一颗激动的心情我竟不知道写点啥,嗯~来点基础的吧!面试的时候一直被问到的集合框架.        集合,也称为容器,可以将一系列元素组合成一个单元,用于存储.提取. ...

  9. nginx upstream和轮询策略

    upstream nginx upstream语法配置 upstream 后面跟服务名 其中包含了,域名,端口 以及权重,可以看到他既支持http协议也支持socket协议的类型,backup意味着该 ...

  10. C++--- Lambda匿名函数表达式

    视频教程:https://www.bilibili.com/video/av66419552/ 格式: [capture](parameters)mutable->returm-type{};  ...