#LC 242•Arrays & Hashing•Easy
Valid Anagram
Decide whether the two strings contain the same characters with the same frequencies.
Understand the problem
Decide whether the two strings contain the same characters with the same frequencies.
Example 1
Input: {"s": "anagram", "t": "nagaram"}
Output: true
Follow the trace to see how the algorithm reaches this result.
Constraints
- Use the input format shown in the example.
Think first
What information should you keep so you can solve the next step efficiently?
Pattern tags:Hash mapFrequency counting