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. vue开大主要难点解决方式

    问题:在我们那vue开发项目时,多层嵌套组件最繁琐,组件传参成最难的问题,并且对兄弟组件传参也无能为力,也会导致代码很难维护. 解决:采用vuex状态管理,把所有的事件和状态都储存在store对象中, ...

  2. Exited too quickly (process log may have details)-配置问题

    在配置supervisor的时候,提示Exited too quickly (process log may have details),这个时候一脸懵逼,啥回事,执行太快了???

  3. 使用maven构建dubbo服务的可执行jar包+Dubbo 程序实例

    https://blog.csdn.net/zsg88/article/details/76100482 https://blog.csdn.net/zsg88/article/details/762 ...

  4. 多线程编程-- part 7 CountDownLatch

    CountDownLatch简介 CountDownLatch是通过“共享锁”实现的.在创建CountDownLatch中时,会传递一个int类型参数count,该参数是“锁计数器”的初始状态,表示该 ...

  5. 日志:slf4j+logback 的配置与使用

    1. 常用日志组件和选择 java开发日志处理是发现和调试bug所 必不可少的,那么现在企业中常用的日志组件有哪些呢,JCL . JUL.  SLF4j.Log4j.  Log4j2 . Logbac ...

  6. js 重要函数

    1. Array.some some() 方法用于检测数组中的元素是否满足指定条件(函数提供) 如果有一个元素满足条件,则表达式返回true , 剩余的元素不会再执行检测.如果没有满足条件的元素,则返 ...

  7. linux 软件安装目录详解

    我一般会在/opt目录下创建 一个software目录,用来存放我们从官网下载的软件格式是.tar.gz文件,或者通过 wget+地址下载的.tar.gz文件 执行解压缩命令,这里以nginx举例 t ...

  8. vue 内存数组变化监听

    watch: { carts: { handler(val, oldVal) { subtotal(this.carts); console.log(this.carts) }, deep: true ...

  9. backtop返回页面顶部jquery代码

    <div id="toTop" style="width:30px;height:110px;border:1px solid #74B9DC; border-ra ...

  10. Summer training round2 #9(Training28)

    A:签到题 C:模拟搜索题 #include <bits/stdc++.h> #include <cstring> #include <iostream> #inc ...