Skip to contentKEEP THE CRAFTTHE SANCTUARY

Valid Anagram

Check whether two strings use exactly the same letters the same number of times.

The problem

Implement Solution.isAnagram(s, t). Return True if t is an anagram of s, meaning t uses exactly the same letters as s, each the same number of times, in any order. Otherwise return False. Both strings contain only lowercase English letters and either may be empty.

Starter code

class Solution:
    def isAnagram(self, s, t):
        pass

Public examples

  1. s = "pearl", t = "paler"givesTrue
  2. s = "aabb", t = "abbb"givesFalse
Open it in the practice book
One thought at a time.