CodeMosa
Master LeetCode Patterns
All Patterns
Collections
Sign In
Back
Arrays & Strings
Question 1 of 12
8% Complete
Easy
To check if two strings are anagrams in O(n), which approach is best?
A
Sort both strings and compare
B
Use a frequency map and compare counts
C
Check pairwise characters greedily
D
Use two pointers from both ends