Doesn't get simpler

  • 0
    class Solution(object):
        def isAnagram(self, s, t):
            return sorted(s) == sorted(t)

  • 0

    It is a logically simple solution. But it is not "simple" from computational aspect. sorted() is of O(nlogn). There are O(n) time solution to this problem.

Log in to reply

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