You are viewing a single comment's thread. Return to all comments →
java solution satisfying all test cases
static int makingAnagrams(String s1, String s2){ int l1,l2,i,j,c=0,e=0; l1=s1.length(); l2=s2.length(); char[] c1= s1.toCharArray(); char[] c2 = s2.toCharArray(); for(i=0;i<l1;i++) { for(j=0;j<l2;j++) { if(c1[i]==c2[j]){ c++; e++; c2[j]='@'; break; } } c=0; } **Strong Text** return (l1-e)+(l2-e); } public static void main(String[] args) { Scanner in = new Scanner(System.in); String s1 = in.next(); String s2 = in.next(); int result = makingAnagrams(s1, s2); System.out.println(result); }
}
Seems like cookies are disabled on this browser, please enable them to open this website
Making Anagrams
You are viewing a single comment's thread. Return to all comments →
java solution satisfying all test cases
}