You are viewing a single comment's thread. Return to all comments →
import java.util.Scanner;
public class Solution {
static boolean isAnagram(String a, String b) { a = a.replaceAll("\\s", "").toLowerCase(); b=b.replaceAll("\\s", "").toLowerCase(); char[] ch1 = a.toCharArray(); char [] ch2 = b.toCharArray(); java.util.Arrays.sort(ch1); java.util.Arrays.sort(ch2); String s1 = new String(ch1); String s2= new String (ch2); if( s1.equals(s2)){ return true; } else { return false; } }
Seems like cookies are disabled on this browser, please enable them to open this website
Java Anagrams
You are viewing a single comment's thread. Return to all comments →
import java.util.Scanner;
public class Solution {