Simple but inefficient python code


  • 0
    Z

    Here is a very simple but inefficient python code. Actually I didn't consider it right at that moment, however, it passed. So I would like to thread this code to see how do you guys think about this function. (Frankly speaking I don't think this works for every possible input)

    def isAnagram(self, s, t):
           lst1 = list(s)
           lst2 = list(t)
           lst1.sort()
           lst2.sort()
           return lst1 == lst2
    

    The feedback shows that it just beats 7.7% python submission, which is quite inefficient!


Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.