题目 Given two strings s and t, write a function to determine if t is an anagram of s. For example, s = "anagram", t = "nagaram", return true. s = "rat", t = "car", return false. python代码 class Solution(object): def isAnagram(self, s, t): """ :type s: str :type t: str :rtype: bool """ s_list =[0]*26 t_list = [0]*26 if len(s) != len(t): return False for i in range(len(s)): s_list[ ord(s[i]) - 97 ] += 1 t_list[ ord(t[i]) - 97 ] +=1 # print(s_list) # print(t_list) if s_list == t_list: return True return False https://leetcode.com/problems/valid-anagram/