We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
- Prepare
- Java
- Strings
- Java Anagrams
- Discussions
Java Anagrams
Java Anagrams
Sort by
recency
|
2446 Discussions
|
Please Login in order to post a comment
i was done it , without using Arrays.sort() ---> but Time Compelxity is O(n^2) in worst case scenario :(
char ch1[] = a.toLowerCase().toCharArray(); char ch2[] = b.toLowerCase().toCharArray();
static boolean isAnagram(String a, String b){
we can not use any library to since import is already disbaled. we can use the loop to find the frequency of every char and we can check if the values of count of each char is equal in every iteration and if length of string is equal then frequency will never gets equal.
Easy solution using inBuild Arrays methods
import java.io.; import java.util.; import java.util.Arrays;
public class Solution {
}