Notes

Personal notes on various topics

View on GitHub

Valid Anagram

Problem Statement

Given two strings s and t, determine if t is an anagram of s. Return true if it is, otherwise return false.

Examples

Example 1:

Input: s = "anagram", t = "nagaram"
Output: true

Example 2:

Input: s = "rat", t = "car"
Output: false

Constraints

Follow Up

How would you adapt your solution if the inputs contain Unicode characters?

Code Template

class Solution:
    def isAnagram(self, s: str, t: str) -> bool:
        # Your code here
        pass

Solutions

Back to Problem List Back to Categories