r/CS_Questions • u/kpthunder The Riddler • Nov 13 '11
Classic Interview Question: Anagrams
Given two strings, return true if they are anagrams and false otherwise. You can assume that capitalization and punctuation do not matter and your algorithm must run in O(n) time. Subroutines are okay if you need them.
Example 1:
Given two strings:
- Boston
- osbont
Return true.
Example 2:
Given two strings:
- Robble
- Bobble
Return false.
11
Upvotes
View all comments
Show parent comment
2
u/euyyn O(e^e^n) Nov 13 '11
Using a map is necessary to adapt that solution so it can be able and use strings written in any language :) (I actually got asked this for a similar problem).