Dashboard
LC #242
Valid Anagram
Pattern · ?AmazonGoogleMetaMicrosoft
Problem
Given two strings s and t, return true if t is an anagram of s — meaning they contain the exact same characters with the same frequencies (order doesn't matter).
Constraints
- 1 ≤ s.length, t.length ≤ 5×10⁴
- s and t consist of lowercase English letters
Example
- Input
- s = "anagram", t = "nagaram"
- Output
- true
- Why
- Both have a×3, n×1, g×1, r×1, m×1
Spot the pattern
Which pattern cracks it?
Hints
One at a time