242. Valid Anagram(python)

0人阅读 评论(0) 收藏 举报
分类:
  1. class Solution(object):  
  2.     def isAnagram(self, s, t):  
  3.         """ 
  4.         :type s: str 
  5.         :type t: str 
  6.         :rtype: bool 
  7.         """  
  8.         if len(s)!=len(t):  
  9.             return False  
  10.           
  11.         s1 = {}  
  12.         for i in list(set(s)):  
  13.             s1[i]=s.count(i)  
  14.         s2 = {}  
  15.         for j in list(set(t)):  
  16.             s2[j]=t.count(j)  
  17.               
  18.         return s1==s2  
  19.               

查看评论

242. Valid Anagram [easy] (Python)

题目链接https://leetcode.com/problems/valid-anagram/题目原文 Given two strings s and t, write a function t...
  • coder_orz
  • coder_orz
  • 2016-05-14 15:07:05
  • 1647

leetcode 242: Valid Anagram

leetcode 242: Valid Anagram python java c++
  • xudli
  • xudli
  • 2015-08-02 15:57:10
  • 6870

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 =...
  • fly_yr
  • fly_yr
  • 2015-11-17 13:33:46
  • 1978

Leetcode:242. Valid Anagram(JAVA)

【问题描述】 Given two strings s and t, write a function to determine if t is an anagram of s. For exam...
  • u010183658
  • u010183658
  • 2016-03-01 11:55:19
  • 585

242. Valid Anagram(Java)

Given two strings s and t, write a function to determine if t is an anagram of s.For example, s = “...
  • Crystal_ting
  • Crystal_ting
  • 2017-08-02 21:00:48
  • 87

LeetCode:242 Valid Anagram Java

Given two strings s and t, write a function to determine if t is an anagram of s.For example, s = “...
  • zuoyexingchennn
  • zuoyexingchennn
  • 2015-08-05 21:07:08
  • 1302

LeetCode 242 Valid Anagram题解

题目:https://leetcode.com/problems/valid-anagram/ 题目: Given two strings s and t, write a functio...
  • v_xchen_v
  • v_xchen_v
  • 2016-12-05 14:19:39
  • 207

【LeetCode-242】Valid Anagram(C++)

题目要求:给出两个字符串s和t,写一个函数判断这两个字符串是否所含字母相同,顺序可以不同。                    例如:“s = "anagram", t = "nagaram",...
  • liujiayu1015
  • liujiayu1015
  • 2016-01-17 21:54:40
  • 346

LeetCode 242. Valid Anagram 题解(C++)

Given two strings s and t, write a function to determine if t is an anagram of s.
  • prayyojay
  • prayyojay
  • 2016-10-19 13:43:33
  • 315

leetcode解题之242# Valid Anagram Java版 (判断两个字母串是否具有相同的字母组合)

leetcode解题之242# Valid Anagram Java版 (判断两个字母串是否具有相同的字母组合)...
  • mine_song
  • mine_song
  • 2017-03-19 13:11:03
  • 423
    个人资料
    等级:
    访问量: 237
    积分: 463
    排名: 11万+
    文章存档
    最新评论
  • 69. Sqrt(x)(pytho...

    CarsX: 题目是叫你实现sqrt方法,而不是让你用sqrt方法。还好leetcodeAC之后还能看别热答案。...