plduhoux
2/21/2018 - 1:25 AM

symbolsPermutation

boolean symbolsPermutation(String word1, String word2) {
    int[] o1 = new int[26], o2 = new int[26];
    for (char c : word1.toCharArray()) o1[c-97]++;
    for (char c : word2.toCharArray()) o2[c-97]++;
    for (int i = 0; i < 26; i++) {
        if (o1[i] != o2[i]) return false;
    }
    return true;
}