You are viewing a single comment's thread. Return to all comments →
Yes, in java to make it work we better need to convert.
int[] missingtracker = new int[26]; first=first.toLowerCase(); second=second.toLowerCase(); if (first.equals(second)) return 0; else { for (int i = 0; i < first.length(); i++) { missingtracker[first.charAt(i) - (int) 'a']--; } for (int j = 0; j < second.length(); j++) { missingtracker[second.charAt(j) - (int) 'a']++; } int count = 0; for (int i : missingtracker) { count += Math.abs(i); } return count; }
Seems like cookies are disabled on this browser, please enable them to open this website
Strings: Making Anagrams
You are viewing a single comment's thread. Return to all comments →
Yes, in java to make it work we better need to convert.