You are viewing a single comment's thread. Return to all comments →
How about my code . It also works fine and is good code with minimum time complexity i think.
if(a.length() != b.length()) return false; int c[] = new int[26], d[] = new int[26] ; a = a.toUpperCase(); b = b.toUpperCase(); for(int i=0; i<a.length(); i++){ c[a.charAt(i) - 'A']++; d[b.charAt(i) - 'A']++; } for(int i =0;i<26; i++) if(c[i] != d[i] ) return false; return true;
Seems like cookies are disabled on this browser, please enable them to open this website
An unexpected error occurred. Please try reloading the page. If problem persists, please contact support@hackerrank.com
Java Anagrams
You are viewing a single comment's thread. Return to all comments →
How about my code . It also works fine and is good code with minimum time complexity i think.