What is the simple brute-force baseline for Valid Anagram?
Practice this question from Valid Anagram - Frequency map Pattern Practice Quiz, with options and an explanation.
Question
What is the simple brute-force baseline for Valid Anagram?
Option A — Correct answer
Sort both strings and compare
Option B
Use a stack for every character
Option C
Run binary search on both strings
Option D
Reverse one string
Explanation
Sorting both strings and comparing them is simple but costs O(n log n).