Are the two strings or phrases anagrams or not algorithm
First thing first, What is anagram?
Anagrams are phrases/words of which one can be created from the other with rearrangement of characters.
Examples of anagram strings:
Debit card and bad credit
George Bush and He Bugs Gore
Now, given two strings, how would do find if the strings are anagrams or not.
The approach I used is a follows:
1. remove the space out of the strings
2. compare the length of strings, if they don’t match, they ain’t anagrams
3. sort the characters of each string
4. check character by character and see if they match till the end
This is approach I used with o(nlogn)
because of the sorting part. All the others can be done in o(n)
A java solution for anagram algorithm
Limit BigDecimal to n decimal places
spring error ClassNotFoundException org.springframework.web.context.ContextLoaderList
The superclass “javax.servlet.http.HttpServlet” was not found on the Java Build Path
String Ordered Permutation Algorithm Problem
setting JAVA_HOME on mac osx