Anagram Check
Problem Given two strings, determine whether they are anagrams of each other (contain exactly the same characters with the same frequencies).
Input / Output
- Input: two strings
sandt - Output: boolean — true if
tis an anagram ofs
Constraints
- Clarify with the interviewer: case sensitivity, whitespace, and Unicode vs. ASCII
- Lengths up to 10^5; O(n) time expected
Example
s = "listen",t = "silent"→trues = "rat",t = "car"→false- Length mismatch is an immediate
false
asked …