class Solution(object):
def isAnagram(self, s, t):
return sorted(list(s)) == sorted(list(t))
Python one line Solution

This is indeed short.
However, looking from computation complexity aspect, sort() has a complexity of O(n log n).
So there is space for improvement.
A O(n) solution is as follows:class Solution(object): def isAnagram(self, s, t): maps = {} mapt = {} for c in s: maps[c] = maps.get(c,0)+1 for c in t: mapt[c] = mapt.get(c,0)+1 return maps == mapt