 All Problems
Valid Anagram
easy
strings
hash map
sorting
amazon
google
microsoft
adobe

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

An anagram is a word or phrase formed by rearranging the letters of a different word or phrase, using all the original letters exactly once.

Example 1:

Input:
anagram
nagaram
Output: true

Example 2:

Input:
rat
car
Output: false

Constraints:

  • 1 ≤ s.length, t.length ≤ 5 × 10⁴
  • s and t consist of lowercase English letters

Input format: First line: string s. Second line: string t.

Output format: true or false

Run to check your code against the sample cases, or submit to run every case